Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ferrostar support for Expo Modules & React Native (Android only for now) #394

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions expo/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
root: true,
extends: ['universe/native', 'universe/web'],
ignorePatterns: ['build'],
};
6 changes: 6 additions & 0 deletions expo/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
android/build
android/gradle

/node_modules/

android/local.properties
14 changes: 14 additions & 0 deletions expo/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Exclude all top-level hidden directories by convention
/.*/

# Exclude tarballs generated by `npm pack`
/*.tgz

__mocks__
__tests__

/babel.config.js
/android/src/androidTest/
/android/src/test/
/android/build/
/example/
33 changes: 33 additions & 0 deletions expo/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Expo Ferrostar

This library is still in development and is not ready for production use.

## Status

- [x] Ferrostar Core Android Implementation
- [x] Ferrostar View Android Implementation
- [ ] Ferrostar Core iOS Implementation
- [ ] Ferrostar View iOS Implementation
- [ ] Documentation

This is a library for using [Ferrostar](https://github.com/stadiamaps/ferrostar) navigation library for [Expo](https://expo.dev/).

## Installation

```sh
expo install expo-ferrostar
```

## Simple Usage

```tsx
import { Ferrostar } from "expo-ferrostar";

export default function App() {
return (
<SafeAreaView style={styles.container}>
<Ferrostar style={{ flex: 1, width: "100%" }} />
</SafeAreaView>
);
}
```
102 changes: 102 additions & 0 deletions expo/android/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
apply plugin: 'com.android.library'

group = 'expo.modules.ferrostar'
version = '0.6.0'

def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle")
apply from: expoModulesCorePlugin
applyKotlinExpoModulesCorePlugin()
useCoreDependencies()
useExpoPublishing()

// If you want to use the managed Android SDK versions from expo-modules-core, set this to true.
// The Android SDK versions will be bumped from time to time in SDK releases and may introduce breaking changes in your module code.
// Most of the time, you may like to manage the Android SDK versions yourself.
buildscript {
ext.kotlin_version = '1.9.24'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TBD whether this is actually required.

// Simple helper that allows the root project to override versions declared by this library.
ext.safeExtGet = { prop, fallback ->
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
}
repositories {
google()
mavenCentral()
maven { url 'https://jitpack.io' }
}
dependencies {
classpath 'com.android.tools.build:gradle:8.3.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
project.android {
compileSdkVersion safeExtGet("compileSdkVersion", 34)
defaultConfig {
minSdkVersion safeExtGet("minSdkVersion", 26)
targetSdkVersion safeExtGet("targetSdkVersion", 34)
}
}

android {
// Enables Compose functionality
buildFeatures {
compose true
}

composeOptions {
kotlinCompilerExtensionVersion '1.5.14'
}

namespace "expo.modules.ferrostar"
defaultConfig {
versionCode 1
versionName "0.6.0"
}
compileOptions {
coreLibraryDesugaringEnabled true
}
lintOptions {
abortOnError false
}
dependencies {
// Desugar
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.1.2'

// Importing Jetpack Compose
def composeBom = platform("androidx.compose:compose-bom:2024.11.00")
implementation composeBom
androidTestImplementation composeBom

implementation "androidx.compose.ui:ui"
implementation "androidx.compose.ui:ui-graphics"
implementation "androidx.compose.material3:material3"
implementation "androidx.activity:activity-compose"

// Ferrostar
def ferrostarVersion = '0.23.0'
implementation "com.stadiamaps.ferrostar:core:${ferrostarVersion}"
Comment on lines +75 to +76
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll need to figure out how to either ensure this is synced with the other projects (update-release-version.sh) or remove the need for hard-coding a version...

Can we reference the main Android gradle workspace? Can we reference its libs.toml?

implementation "com.stadiamaps.ferrostar:maplibreui:${ferrostarVersion}"
implementation "com.stadiamaps.ferrostar:composeui:${ferrostarVersion}"

// Optional - if using Google Play Service's FusedLocation
implementation "com.stadiamaps.ferrostar:google-play-services:${ferrostarVersion}"
implementation "com.google.android.gms:play-services-location:21.3.0"

// okhttp3
implementation platform("com.squareup.okhttp3:okhttp-bom:4.12.0")
implementation 'com.squareup.okhttp3:okhttp'

implementation "androidx.compose.ui:ui-tooling-preview"
debugImplementation "androidx.compose.ui:ui-tooling"

// React Native
implementation "com.facebook.react:react-native:+"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can delete this per the review call.

}
}

allprojects {
repositories {
google()
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
Loading
Loading