You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Please use the Community Template as a reference point for the [Gemfile](https://github.com/react-native-community/template/blob/0.78-stable/template/Gemfile) and for the [Podfile](https://github.com/react-native-community/template/blob/0.78-stable/template/ios/Podfile).
116
116
117
117
:::note
118
-
Remember to change [this line](https://github.com/react-native-community/template/blob/0.78-stable/template/ios/Podfile#L17) and [this line](https://github.com/react-native-community/template/blob/0.78-stable/template/ios/Podfile#L26) of the Podfile to match the name of your app.
119
-
120
-
If your app don't have tests, remember to remove [this block](https://github.com/react-native-community/template/blob/0.78-stable/template/ios/Podfile#L26-L29).
118
+
Remember to change [this line](https://github.com/react-native-community/template/blob/0.78-stable/template/ios/Podfile#L17).
121
119
:::
122
120
123
121
Now, we need to run a couple of extra commands to install the Ruby gems and the Pods.
@@ -258,6 +256,8 @@ Now open the `ReactViewController.m` file and apply the following changes
258
256
+#import <React/RCTBundleURLProvider.h>
259
257
+#import <RCTReactNativeFactory.h>
260
258
+#import <RCTDefaultReactNativeFactoryDelegate.h>
259
+
+#import <RCTAppDependencyProvider.h>
260
+
261
261
262
262
@interface ReactViewController ()
263
263
@@ -275,7 +275,8 @@ Now open the `ReactViewController.m` file and apply the following changes
275
275
- (void)viewDidLoad {
276
276
[super viewDidLoad];
277
277
// Do any additional setup after loading the view.
Now, if you build your app for Release, it will work as expected.
515
518
516
-
### Now what?
519
+
## 7. Passing initial props to the React Native view
520
+
521
+
In some case, you'd like to pass some information from the Native app to JavaScript. For example, you might want to pass the user id of the currently logged user to React Native, together with a token that can be used to retrieve information from a database.
522
+
523
+
This is possible by using the `initialProperties` parameter of the `view(withModuleName:initialProperty)` overload of the `RCTReactNativeFactory` class. The following steps shows you how to do it.
524
+
525
+
### Update the App.tsx file to read the initial properties.
526
+
527
+
Open the `App.tsx` file and add the following code:
These changes will tell React Native that your App component is now accepting some properties. The `RCTreactNativeFactory` will take care of passing them to the component when it's rendered.
594
+
595
+
### Update the Native code to pass the initial properties to JavaScript.
At this point you can continue developing your app as usual. Refer to our [debugging](debugging) and [deployment](running-on-device) docs to learn more about working with React Native.
Copy file name to clipboardExpand all lines: docs/_integration-with-existing-apps-kotlin.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -424,7 +424,7 @@ class MyReactActivity : ReactActivity() {
424
424
</TabItem>
425
425
</Tabs>
426
426
427
-
As usual, here the [MainActivity.kt Community template file as reference](https://github.com/react-native-community/template/blob/0.77-stable/template/android/app/src/main/java/com/helloworld/MainApplication.kt)
427
+
As usual, here the [MainActivity.kt Community template file as reference](https://github.com/react-native-community/template/blob/0.80-stable/template/android/app/src/main/java/com/helloworld/MainActivity.kt)
428
428
429
429
Whenever you create a new Activity, you need to add it to your `AndroidManifest.xml` file. You also need set the theme of `MyReactActivity` to `Theme.AppCompat.Light.NoActionBar` (or to any non-ActionBar theme) as otherwise your application will render an ActionBar on top of your React Native screen:
Copy file name to clipboardExpand all lines: docs/accessibility.md
+10-6Lines changed: 10 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,18 +14,20 @@ Android and iOS differ slightly in their approaches, and thus the React Native i
14
14
15
15
### `accessible`
16
16
17
-
When `true`, indicates that the view is an accessibility element. When a view is an accessibility element, it groups its children into a single selectable component. By default, all touchable elements are accessible.
17
+
When `true`, indicates that the view is discoverable by assistive technologies such as screen readers and hardware keyboards. Note that this does not necessarily mean that the view will be focused by VoiceOver or TalkBack. There are a number of reasons for this, such as VoiceOver disallowing nested acecssibility elements, or TalkBack opting to focus some parent element instead.
18
18
19
-
On Android, `accessible={true}` property for a react-native View will be translated into native `focusable={true}`.
19
+
By default, all touchable elements are accessible.
20
+
21
+
On Android, `accessible` will be translated into native [`focusable`](<https://developer.android.com/reference/android/view/View#setFocusable(boolean)>). On iOS, it translates into native [`isAccessibilityElement`](https://developer.apple.com/documentation/uikit/uiaccessibilityelement/isaccessibilityelement?language=objc).
20
22
21
23
```tsx
22
-
<Viewaccessible={true}>
23
-
<Text>text one</Text>
24
-
<Text>text two</Text>
24
+
<View>
25
+
<Viewaccessible={true} />
26
+
<View />
25
27
</View>
26
28
```
27
29
28
-
In the above example, accessibility focus is only available on the parent view with the `accessible` property, and not individually for 'text one' and 'text two'.
30
+
In the above example, accessibility focus is only available on the first child view with the `accessible` property, and not for the parent or sibling without `accessible`.
29
31
30
32
### `accessibilityLabel`
31
33
@@ -427,6 +429,8 @@ When adding support for standard actions, `name` must be one of the following:
427
429
-`'increment'` - Increment an adjustable component. On iOS, VoiceOver generates this action when the component has a role of `'adjustable'` and the user places focus on it and swipes upward. On Android, TalkBack generates this action when the user places accessibility focus on the component and presses the volume-up button.
428
430
-`'decrement'` - Decrement an adjustable component. On iOS, VoiceOver generates this action when the component has a role of `'adjustable'` and the user places focus on it and swipes downward. On Android, TalkBack generates this action when the user places accessibility focus on the component and presses the volume-down button.
429
431
-`'longpress'` - Android only - This action is generated when the user places accessibility focus on the component, then double-taps and holds one finger on the screen. This should perform the same action with, or without, assistive technology.
432
+
-`'expand'` - Android only - This action "expands" the component so that TalkBack will announce an "expanded" hint.
433
+
-`'collapse'` - Android only - This action "collapses" the component so that TalkBack will announce a "collapsed" hint.
430
434
431
435
The `label` field is optional for standard actions and is often unused by assistive technologies. For custom actions, it is a localized string containing a description of the action to be presented to the user.
Copy file name to clipboardExpand all lines: docs/build-speed.md
+31Lines changed: 31 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,6 +8,12 @@ This can be problematic as your project grows and generally in bigger organizati
8
8
9
9
To mitigate this performance hit, this page shares some suggestions on how to **improve your build time**.
10
10
11
+
:::info
12
+
13
+
Please note that those suggestions are advanced feature that requires some amount of understanding of how the native build tools work.
14
+
15
+
:::
16
+
11
17
## Build only one ABI during development (Android-only)
12
18
13
19
When building your android app locally, by default you build all the 4 [Application Binary Interfaces (ABIs)](https://developer.android.com/ndk/guides/abis) : `armeabi-v7a`, `arm64-v8a`, `x86` & `x86_64`.
Once you build a **release version** of your app, don't forget to remove those flags as you want to build an apk/app bundle that works for all the ABIs and not only for the one you're using in your daily development workflow.
52
58
59
+
## Enable Configuration Caching (Android-only)
60
+
61
+
Since React Native 0.79, you can also enable Gradle Configuration Caching.
62
+
63
+
When you’re running an Android build with `yarn android`, you will be executing a Gradle build that is composed by two steps ([source](https://docs.gradle.org/current/userguide/build_lifecycle.html)):
64
+
65
+
- Configuration phase, when all the `.gradle` files are evaluated.
66
+
- Execution phase, when the tasks are actually executed so the Java/Kotlin code is compiled and so on.
67
+
68
+
You will now be able to enable Configuration Caching, which will allow you to skip the Configuration phase on subsequent builds.
69
+
70
+
This is beneficial when making frequent changes to the native code as it improves build times.
71
+
72
+
For example here you can see how rebuilding faster it is to rebuild RN-Tester after a change in the native code:
You can enable Gradle Configuration Caching by adding the following line in your `android/gradle.properties` file:
77
+
78
+
```
79
+
org.gradle.configuration-cache=true
80
+
```
81
+
82
+
Please refer to the [official Gradle documentation](https://docs.gradle.org/current/userguide/configuration_cache.html) for more resources on Configuration Caching.
83
+
53
84
## Use a compiler cache
54
85
55
86
If you're running frequent native builds (either C++ or Objective-C), you might benefit from using a **compiler cache**.
0 commit comments