Skip to content

Commit 53dd1dc

Browse files
authored
chore: support for React Native 0.71.0 (#1631)
## Description It seems that autolinking got complete overhaul in 0.71.0 as `android/app/src/main/jni` directory was deleted -> thus it works differently for sure now. Still need to dive into it. **FabricTestExample** * [x] Android * [x] iOS **TestsExample** * software-mansion/react-native-screens#1679 **FabricExample** * software-mansion/react-native-screens#1680 **TODO**: Consider whether to use `com.facebook.react:react-native:+` or `com.facebook.react:react-native` (without `+`) in `android/build.gradle` of the library. AFAIK the former takes highest available version from defined repositories (should be `node_modules`?), the latter uses version injected by React Native Gradle Plugin (but I believe it works since React Native 0.71.0 or 0.70.0 (need to check) -- so version check might be necessary). Decided to leave: ```gradle implementation 'com.facebook.react:react-native:+' ``` in library's `android/build.gradle` due to following reasons: * [Android's readme in RN repo](https://github.com/facebook/react-native/blob/e108e9ebf1e6c52b6eeffeb6c41f842ad95baa0d/android/README.md) * [Road to 0.71.0 post](reactwg/react-native-releases#41 (reply in thread)) Blocked by: * ~facebook/react-native#35306 * ~software-mansion/react-native-reanimated#3745 * ~software-mansion/react-native-gesture-handler#2313 (decided to fix version on commit) * ~`react-native-safe-area-context` - lacks support for RN71~ (created patch) * ~`@react-native-community/cli-platform-android` requires this patch: kkafar/RNS-tester@9edaaa9. The patch is already merged, but it is not shipped with `react-native` yet.~ **NOTE**: Example application will handled in separate PR, as there are problems with detox (it does not support 0.71 yet) and we run CI on that app. ## Changes * Updated examples * Updated library's build code ## Test code and steps to reproduce Run example applications ## Checklist - [ ] Ensured that CI passes
1 parent 1769bc2 commit 53dd1dc

File tree

138 files changed

+12096
-15924
lines changed

Some content is hidden

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

138 files changed

+12096
-15924
lines changed

.github/workflows/ios-e2e-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ on:
1515
workflow_dispatch:
1616
jobs:
1717
test:
18-
runs-on: macos-latest
18+
runs-on: macos-12
1919
timeout-minutes: 40
2020
env:
2121
WORKING_DIRECTORY: Example

Example/App.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,8 @@ const ExampleApp = (): JSX.Element => (
161161
<Stack.Navigator
162162
screenOptions={{
163163
direction: I18nManager.isRTL ? 'rtl' : 'ltr',
164-
}}>
164+
}}
165+
>
165166
<Stack.Screen
166167
name="Main"
167168
options={{ title: '📱 React Native Screens Examples' }}

Example/src/screens/Animations.tsx

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -120,15 +120,15 @@ const NavigateScreen = ({
120120
const Stack = createNativeStackNavigator<StackParamList>();
121121

122122
const App = (): JSX.Element => {
123-
const [stackAnimation, setStackAnimation] = useState<StackAnimation>(
124-
'default'
125-
);
123+
const [stackAnimation, setStackAnimation] =
124+
useState<StackAnimation>('default');
126125
return (
127126
<Stack.Navigator
128127
screenOptions={{
129128
headerHideBackButton: true,
130129
direction: I18nManager.isRTL ? 'rtl' : 'ltr',
131-
}}>
130+
}}
131+
>
132132
<Stack.Screen name="Main" options={{ title: 'Animations' }}>
133133
{({ navigation }) => (
134134
<MainScreen
@@ -142,7 +142,8 @@ const App = (): JSX.Element => {
142142
name="Push"
143143
options={{
144144
replaceAnimation: 'push',
145-
}}>
145+
}}
146+
>
146147
{({ navigation }) => (
147148
<ReplaceScreen
148149
navigation={navigation}
@@ -154,7 +155,8 @@ const App = (): JSX.Element => {
154155
name="Pop"
155156
options={{
156157
replaceAnimation: 'pop',
157-
}}>
158+
}}
159+
>
158160
{({ navigation }) => (
159161
<ReplaceScreen
160162
navigation={navigation}
@@ -166,7 +168,8 @@ const App = (): JSX.Element => {
166168
name="Modal"
167169
options={{
168170
stackPresentation: 'modal',
169-
}}>
171+
}}
172+
>
170173
{({ navigation }) => (
171174
<NavigateScreen
172175
navigation={navigation}

Example/src/screens/BottomTabsAndStack.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,8 @@ const createStack = (letter: string) => {
7373
headerRight: () => (
7474
<Text testID="bottom-tabs-header-right-id">{letter}</Text>
7575
),
76-
}}>
76+
}}
77+
>
7778
<Stack.Screen name="Details" component={DetailsScreen} />
7879
</Stack.Navigator>
7980
);

Example/src/screens/Events.tsx

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,8 @@ const ChatsScreen = ({
149149
nativeBackButtonDismissalEnabled: true,
150150
headerTopInsetEnabled: false,
151151
headerHideBackButton: true,
152-
}}>
152+
}}
153+
>
153154
<NestedStack.Screen name="Privacy" component={PrivacyScreen} />
154155
<NestedStack.Screen name="Options" component={OptionsScreen} />
155156
</NestedStack.Navigator>
@@ -250,20 +251,21 @@ const Stack = createNativeStackNavigator<StackParamList>();
250251
const NestedStack = createNativeStackNavigator<StackParamList>();
251252

252253
const App = (): JSX.Element => {
253-
const [stackAnimation, setStackAnimation] = useState<StackAnimation>(
254-
'default'
255-
);
254+
const [stackAnimation, setStackAnimation] =
255+
useState<StackAnimation>('default');
256256

257257
return (
258258
<ToastProvider>
259259
<Stack.Navigator
260260
screenOptions={{
261261
direction: I18nManager.isRTL ? 'rtl' : 'ltr',
262262
nativeBackButtonDismissalEnabled: true,
263-
}}>
263+
}}
264+
>
264265
<Stack.Screen
265266
name="Main"
266-
options={{ title: 'Events', headerHideBackButton: true }}>
267+
options={{ title: 'Events', headerHideBackButton: true }}
268+
>
267269
{({ navigation }) => (
268270
<MainScreen
269271
navigation={navigation}

Example/src/screens/Gestures.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,8 @@ const DetailsScreen = ({ navigation }: DetailsScreenProps): JSX.Element => {
152152
left: startValue,
153153
width: endValue - startValue,
154154
height: bottomValue - topValue,
155-
}}>
155+
}}
156+
>
156157
<Text style={styles.heading}>Swipe here!</Text>
157158
<Text>
158159
This view presents where you can currently swipe while using the
@@ -171,7 +172,8 @@ const App = (): JSX.Element => (
171172
screenOptions={{
172173
headerHideBackButton: true,
173174
direction: I18nManager.isRTL ? 'rtl' : 'ltr',
174-
}}>
175+
}}
176+
>
175177
<Stack.Screen
176178
name="Main"
177179
component={MainScreen}

Example/src/screens/HeaderOptions.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,8 @@ const SettingsScreen = ({ navigation }: SettingsScreenProps): JSX.Element => {
8787
return (
8888
<ScrollView
8989
contentInsetAdjustmentBehavior="automatic"
90-
style={styles.container}>
90+
style={styles.container}
91+
>
9192
<SettingsInput
9293
label="Header title"
9394
value={headerTitle}
@@ -142,7 +143,8 @@ const App = (): JSX.Element => (
142143
screenOptions={{
143144
headerHideBackButton: true,
144145
direction: I18nManager.isRTL ? 'rtl' : 'ltr',
145-
}}>
146+
}}
147+
>
146148
<Stack.Screen
147149
name="Main"
148150
options={{

Example/src/screens/Modals.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ const App = (): JSX.Element => (
5252
screenOptions={{
5353
headerHideBackButton: true,
5454
direction: I18nManager.isRTL ? 'rtl' : 'ltr',
55-
}}>
55+
}}
56+
>
5657
<Stack.Screen
5758
name="Main"
5859
component={MainScreen}

Example/src/screens/Orientation.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,8 @@ interface FirstScreenProps {
2323
}
2424

2525
const FirstScreen = ({ navigation }: FirstScreenProps): JSX.Element => {
26-
const [screenOrientation, setScreenOrientation] = useState<ScreenOrientation>(
27-
'default'
28-
);
26+
const [screenOrientation, setScreenOrientation] =
27+
useState<ScreenOrientation>('default');
2928

3029
useLayoutEffect(() => {
3130
navigation.setOptions({
@@ -79,7 +78,8 @@ const App = (): JSX.Element => (
7978
screenOptions={{
8079
headerHideBackButton: true,
8180
direction: I18nManager.isRTL ? 'rtl' : 'ltr',
82-
}}>
81+
}}
82+
>
8383
<Stack.Screen
8484
name="First"
8585
component={FirstScreen}

Example/src/screens/SearchBar.tsx

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -36,18 +36,15 @@ const MainScreen = ({ navigation }: MainScreenProps): JSX.Element => {
3636
const [placeholder, setPlaceholder] = useState('Search for something...');
3737
const [barTintColor, setBarTintColor] = useState<BarTintColor>('white');
3838
const [hintTextColor, setHintTextColor] = useState<BarTintColor>('orange');
39-
const [headerIconColor, setHeaderIconColor] = useState<BarTintColor>(
40-
'orange'
41-
);
42-
const [shouldShowHintSearchIcon, setShouldShowHintSearchIcon] = useState(
43-
true
44-
);
39+
const [headerIconColor, setHeaderIconColor] =
40+
useState<BarTintColor>('orange');
41+
const [shouldShowHintSearchIcon, setShouldShowHintSearchIcon] =
42+
useState(true);
4543
const [hideWhenScrolling, setHideWhenScrolling] = useState(false);
4644
const [obscureBackground, setObscureBackground] = useState(false);
4745
const [hideNavigationBar, setHideNavigationBar] = useState(false);
48-
const [autoCapitalize, setAutoCapitalize] = useState<AutoCapitalize>(
49-
'sentences'
50-
);
46+
const [autoCapitalize, setAutoCapitalize] =
47+
useState<AutoCapitalize>('sentences');
5148
const [inputType, setInputType] = useState<InputType>('text');
5249

5350
useLayoutEffect(() => {
@@ -115,7 +112,8 @@ const MainScreen = ({ navigation }: MainScreenProps): JSX.Element => {
115112
<ScrollView
116113
style={styles.container}
117114
contentInsetAdjustmentBehavior="automatic"
118-
keyboardDismissMode="on-drag">
115+
keyboardDismissMode="on-drag"
116+
>
119117
<SettingsInput
120118
label="Placeholder"
121119
value={placeholder}
@@ -223,7 +221,8 @@ const SearchScreen = ({ navigation }: SearchScreenProps) => {
223221
return (
224222
<ScrollView
225223
contentInsetAdjustmentBehavior="automatic"
226-
keyboardDismissMode="on-drag">
224+
keyboardDismissMode="on-drag"
225+
>
227226
{places
228227
.filter(
229228
(item) => item.toLowerCase().indexOf(search.toLowerCase()) !== -1
@@ -247,7 +246,8 @@ const App = (): JSX.Element => (
247246
screenOptions={{
248247
headerHideBackButton: true,
249248
direction: I18nManager.isRTL ? 'rtl' : 'ltr',
250-
}}>
249+
}}
250+
>
251251
<Stack.Screen
252252
name="Main"
253253
component={MainScreen}

0 commit comments

Comments
 (0)