Skip to content

Commit d54a496

Browse files
committed
feat!: support new React Native architecture
1 parent eb7cca8 commit d54a496

File tree

240 files changed

+25675
-12989
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

240 files changed

+25675
-12989
lines changed

.github/ISSUE_TEMPLATE/bug_report.yml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,16 @@ body:
6060
attributes:
6161
label: React Native Doctor Output
6262
description: |
63-
Run `npx react-native doctor` in your projectq and paste the output below.
63+
Run `npx react-native doctor` in your project folder and paste the output below.
64+
render: shell
65+
validations:
66+
required: true
67+
- type: textarea
68+
attributes:
69+
label: React Native Info Output
70+
description: |
71+
Run `npx react-native info` in your project folder and paste the output below.
72+
render: shell
6473
validations:
6574
required: true
6675
- type: textarea
@@ -96,9 +105,13 @@ body:
96105
Without this we will unlikely be able to progress on the issue,
97106
as we need to be able to reproduce the problem locally.
98107
value: |
108+
<details open><summary>Code sample</summary>
109+
99110
```javascript
100111
// Example code here
101112
```
113+
114+
</details>
102115
validations:
103116
required: true
104117
- type: textarea

.github/workflows/ci.yml

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737
run: yarn lint
3838

3939
- name: Typecheck files
40-
run: yarn test:types
40+
run: yarn typecheck
4141

4242
check-objc-formatting:
4343
runs-on: ubuntu-latest
@@ -52,7 +52,7 @@ jobs:
5252
- name: Check Objective-C formatting
5353
run: ./scripts/format-objc.sh --check
5454

55-
check-java-formatting:
55+
check-java-and-kotlin-formatting:
5656
runs-on: ubuntu-latest
5757
timeout-minutes: 30
5858
steps:
@@ -84,6 +84,24 @@ jobs:
8484
- name: Check Java formatting
8585
run: ./scripts/format-java.sh --check
8686

87+
- name: Download ktfmt
88+
run: |
89+
KTFMT_VERSION=0.54
90+
KTFMT_URL=https://repo1.maven.org/maven2/com/facebook/ktfmt/${KTFMT_VERSION}/ktfmt-${KTFMT_VERSION}-jar-with-dependencies.jar
91+
mkdir -p $HOME/ktfmt
92+
curl -L -o $HOME/ktfmt/ktfmt.jar $KTFMT_URL
93+
94+
- name: Create ktfmt wrapper script
95+
run: |
96+
cat << 'EOF' > /usr/local/bin/ktfmt
97+
#!/bin/sh
98+
exec java -jar "$HOME/ktfmt/ktfmt.jar" "$@"
99+
EOF
100+
chmod +x /usr/local/bin/ktfmt
101+
102+
- name: Check Kotlin formatting
103+
run: ./scripts/format-kotlin.sh --check
104+
87105
test:
88106
runs-on: ubuntu-latest
89107
timeout-minutes: 30
@@ -222,7 +240,7 @@ jobs:
222240
NO_FLIPPER: 1
223241

224242
- name: Copy Keys.plist file from sample
225-
run: cp example/ios/SampleApp/Keys.plist.sample example/ios/SampleApp/Keys.plist
243+
run: cp example/ios/ReactNativeNavigationSdkExample/Keys.plist.sample example/ios/ReactNativeNavigationSdkExample/Keys.plist
226244

227245
- name: Build example for iOS
228246
run: |

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ DerivedData
2828
*.ipa
2929
*.xcuserstate
3030
project.xcworkspace
31-
.xcode.env.local
31+
**/.xcode.env.local
3232
Keys.plist
3333

3434
# Android/IJ
@@ -81,5 +81,5 @@ android/keystores/debug.keystore
8181
# generated by bob
8282
lib/
8383

84-
# tests
84+
# Tests
8585
coverage/

.npmignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
example
22
coverage
3-
node_modules
3+
node_modules
4+
scripts

.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v18
1+
v20

.tool-versions

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
nodejs 18.20.1
1+
nodejs 20.18.3

.watchmanconfig

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
1-
{
2-
"fsevents_latency": 0.1
3-
}
1+
{}

.yarnrc.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ nmHoistingLimits: workspaces
1717

1818
plugins:
1919
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
20-
spec: "@yarnpkg/plugin-interactive-tools"
20+
spec: '@yarnpkg/plugin-interactive-tools'
2121
- path: .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs
22-
spec: "@yarnpkg/plugin-workspace-tools"
22+
spec: '@yarnpkg/plugin-workspace-tools'
2323

2424
yarnPath: .yarn/releases/yarn-3.6.1.cjs

ANDROIDAUTO.md

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ For all the steps above, you can refer to the Android example application for gu
2020

2121
### Screen for Android Auto
2222

23-
Once your project is configured accordingly, and you are ready to build the screen for Android Auto, you can leverage the `AndroidAutoBaseScreen` provided by the SDK. This base class simplifies the setup by handling initialization, teardown, and rendering the map on the Android Auto display.
23+
Once your project is configured accordingly, and you are ready to build the screen for Android Auto, you can leverage the `GMNAndroidAutoBaseScreen` provided by the SDK. This base class simplifies the setup by handling initialization, teardown, and rendering the map on the Android Auto display.
2424

2525
Please refer to the `SampleAndroidAutoScreen.java` file in the Android example app for guidance.
2626

@@ -61,7 +61,7 @@ public Template onGetTemplate() {
6161
}
6262
```
6363

64-
For advanced customization, you can bypass the base class and implement your own screen by inheriting `Screen`. You can use the provided `AndroidAutoBaseScreen` base class as a reference on how to do that.
64+
For advanced customization, you can bypass the base class and implement your own screen by inheriting `Screen`. You can use the provided `GMNAndroidAutoBaseScreen` base class as a reference on how to do that.
6565

6666
### React Native specific setup
6767

@@ -70,22 +70,25 @@ On the React Native side, you can use the `useNavigationAuto` hook to interface
7070
```tsx
7171
const {
7272
mapViewAutoController,
73-
addListeners: addAutoListener,
74-
removeListeners: removeAutoListeners,
7573
} = useNavigationAuto();
7674

77-
const navigationAutoCallbacks: NavigationAutoCallbacks = useMemo(
78-
() => ({
79-
onCustomNavigationAutoEvent: (event: CustomNavigationAutoEvent) => {
80-
console.log('onCustomNavigationAutoEvent:', event);
81-
},
82-
onAutoScreenAvailabilityChanged: (available: boolean) => {
75+
useEffect(() => {
76+
mapViewAutoController.setOnAutoScreenAvailabilityChangedListener(
77+
(available: boolean) => {
8378
console.log('onAutoScreenAvailabilityChanged:', available);
8479
setMapViewAutoAvailable(available);
85-
},
86-
}),
87-
[]
88-
);
80+
}
81+
);
82+
mapViewAutoController.setOnCustomNavigationAutoEventListener(
83+
(event: CustomNavigationAutoEvent) => {
84+
console.log('onCustomNavigationAutoEvent:', event);
85+
}
86+
);
87+
88+
return () => {
89+
mapViewAutoController.removeAllListeners();
90+
};
91+
});
8992

9093
const setMapType = (mapType: MapType) => {
9194
console.log('setMapType', mapType);

CARPLAY.md

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -56,22 +56,25 @@ On the React Native side, you can use the `useNavigationAuto` hook to interface
5656
```tsx
5757
const {
5858
mapViewAutoController,
59-
addListeners: addAutoListener,
60-
removeListeners: removeAutoListeners,
6159
} = useNavigationAuto();
6260

63-
const navigationAutoCallbacks: NavigationAutoCallbacks = useMemo(
64-
() => ({
65-
onCustomNavigationAutoEvent: (event: CustomNavigationAutoEvent) => {
66-
console.log('onCustomNavigationAutoEvent:', event);
67-
},
68-
onAutoScreenAvailabilityChanged: (available: boolean) => {
61+
useEffect(() => {
62+
mapViewAutoController.setOnAutoScreenAvailabilityChangedListener(
63+
(available: boolean) => {
6964
console.log('onAutoScreenAvailabilityChanged:', available);
7065
setMapViewAutoAvailable(available);
71-
},
72-
}),
73-
[]
74-
);
66+
}
67+
);
68+
mapViewAutoController.setOnCustomNavigationAutoEventListener(
69+
(event: CustomNavigationAutoEvent) => {
70+
console.log('onCustomNavigationAutoEvent:', event);
71+
}
72+
);
73+
74+
return () => {
75+
mapViewAutoController.removeAllListeners();
76+
};
77+
});
7578

7679
const setMapType = (mapType: MapType) => {
7780
console.log('setMapType', mapType);
@@ -83,4 +86,4 @@ For a more detailed example, refer to the `NavigationScreen.tsx` in the React Na
8386

8487
## Example Project
8588

86-
For a fully functional CarPlay implementation, check out the [SampleApp](./example/ios/) Xcode project, which includes the `SampleAppCarPlay` build target. The sample already contains test entitlement so you don't need to request one from Apple to run it.
89+
For a fully functional CarPlay implementation, check out the [SampleApp](./example/ios/) Xcode project, which includes the `ReactNativeNavigationSdkExampleCarPlay` build target. The sample already contains test entitlement so you don't need to request one from Apple to run it.

0 commit comments

Comments
 (0)