Skip to content

Commit 0b4e8b3

Browse files
authored
Merge pull request #931 from facebook/main
sync
2 parents 3331108 + f3f81e3 commit 0b4e8b3

File tree

233 files changed

+44864
-123
lines changed

Some content is hidden

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

233 files changed

+44864
-123
lines changed

docs/_integration-with-existing-apps-ios.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ First, we need to extends the `AppDelegate` to inherit from one of the classes p
279279

280280
To achieve this, we have to modify the `AppDelegate.h` file and the `AppDelegate.m` files:
281281

282-
1. Open the `AppDelegate.h` files and modify it as it follows (See the official template's [AppDelegate.h](https://github.com/react-native-community/template/blob/0.77-stable/template/ios/HelloWorld/AppDelegate.h) as reference):
282+
1. Open the `AppDelegate.h` files and modify it as it follows (See the official template's [AppDelegate.h](https://github.com/react-native-community/template/blob/0.76-stable/template/ios/HelloWorld/AppDelegate.h) as reference):
283283

284284
```diff title="AppDelegate.h changes"
285285
#import <UIKit/UIKit.h>
@@ -292,7 +292,7 @@ To achieve this, we have to modify the `AppDelegate.h` file and the `AppDelegate
292292
@end
293293
```
294294

295-
2. Open the `AppDelegate.mm` file and modify it as it follows (See the official template's [AppDelegate.mm](https://github.com/react-native-community/template/blob/0.77-stable/template/ios/HelloWorld/AppDelegate.mm) as reference
295+
2. Open the `AppDelegate.mm` file and modify it as it follows (See the official template's [AppDelegate.mm](https://github.com/react-native-community/template/blob/0.76-stable/template/ios/HelloWorld/AppDelegate.mm) as reference
296296

297297
```diff title="AppDelegate.mm"
298298
#import "AppDelegate.h"

docs/boxshadowvalue.md

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
---
2+
id: boxshadowvalue
3+
title: BoxShadowValue Object Type
4+
---
5+
6+
The `BoxShadowValue` object is taken by the [`boxShadow`](./view-style-props.md#boxshadow) style prop. It is comprised of 2-4 lengths, an optional color, and an optional `inset` boolean. These values collectively define the box shadow's color, position, size, and blurriness.
7+
8+
## Example
9+
10+
```js
11+
{
12+
offsetX: 10,
13+
offsetY: -3,
14+
blurRadius: '15px',
15+
spreadDistance: '10px',
16+
color: 'red',
17+
inset: true,
18+
}
19+
```
20+
21+
## Keys and values
22+
23+
### `offsetX`
24+
25+
The offset on the x-axis. This can be positive or negative. A positive value indicates right and negative indicates left.
26+
27+
| Type | Optional |
28+
| ---------------- | -------- |
29+
| number \| string | No |
30+
31+
### `offsetY`
32+
33+
The offset on the y-axis. This can be positive or negative. A positive value indicates up and negative indicates down.
34+
35+
| Type | Optional |
36+
| ---------------- | -------- |
37+
| number \| string | No |
38+
39+
### `blurRadius`
40+
41+
Represents the radius used in the [Guassian blur](https://en.wikipedia.org/wiki/Gaussian_blur) algorithm. The larger the value the blurrier the shadow is. Only non-negative values are valid. The default is 0.
42+
43+
| Type | Optional |
44+
| --------------- | -------- |
45+
| numer \| string | Yes |
46+
47+
### `spreadDistance`
48+
49+
How much larger or smaller the shadow grows or shrinks. A positive value will grow the shadow, a negative value will shrink the shadow.
50+
51+
| Type | Optional |
52+
| --------------- | -------- |
53+
| numer \| string | Yes |
54+
55+
### `color`
56+
57+
The color of the shadow. The default is `black`.
58+
59+
| Type | Optional |
60+
| -------------------- | -------- |
61+
| [color](./colors.md) | Yes |
62+
63+
### `inset`
64+
65+
Whether the shadow is inset or not. Inset shadows will appear around the inside of the element's border box as opposed to the outside.
66+
67+
| Type | Optional |
68+
| ------- | -------- |
69+
| boolean | Yes |
70+
71+
## Used by
72+
73+
- [`boxShadow`](./view-style-props.md#boxshadow)

docs/debugging-native-code.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,47 @@ npx react-native log-ios
2323

2424
You may also access these through Debug > Open System Log… in the iOS Simulator or by running `adb logcat "*:S" ReactNative:V ReactNativeJS:V` in a terminal while an Android app is running on a device or emulator.
2525

26+
<details>
27+
<summary>**💡 Custom Native Logs**</summary>
28+
29+
If you are writing a Native Module and want to add custom logs to your module for debugging purposes, you can use the following method:
30+
31+
#### Android (Java/Kotlin)
32+
33+
In your native module, use the `Log` class to add logs that can be viewed in Logcat:
34+
35+
```java
36+
import android.util.Log;
37+
38+
private void log(String message) {
39+
Log.d("YourModuleName", message);
40+
}
41+
```
42+
43+
To view these logs in Logcat, use this command, replacing `YourModuleName` with your custom tag:
44+
45+
```shell
46+
adb logcat "*:S" ReactNative:V ReactNativeJS:V YourModuleName:D
47+
```
48+
49+
#### iOS (Objective-C/Swift)
50+
51+
In your native module, use `NSLog` for custom logs:
52+
53+
```objective-c
54+
NSLog(@"YourModuleName: %@", message);
55+
```
56+
57+
Or, in Swift:
58+
59+
```swift
60+
print("YourModuleName: \(message)")
61+
```
62+
63+
These logs will appear in the Xcode console when running the app.
64+
65+
</details>
66+
2667
## Debugging in a Native IDE
2768

2869
When working with native code, such as when writing native modules, you can launch the app from Android Studio or Xcode and take advantage of the native debugging features (setting up breakpoints, etc.) as you would in case of building a standard native app.

docs/dropshadowvalue.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
---
2+
id: dropshadowvalue
3+
title: DropShadowValue Object Type
4+
---
5+
6+
The `DropShadowValue` object is taken by the [`filter`](./view-style-props.md#filter) style prop for the `dropShadow` function. It is comprised of 2 or 3 lengths and an optional color. These values collectively define the drop shadow's color, position, and blurriness.
7+
8+
## Example
9+
10+
```js
11+
{
12+
offsetX: 10,
13+
offsetY: -3,
14+
standardDeviation: '15px',
15+
color: 'blue',
16+
}
17+
```
18+
19+
## Keys and values
20+
21+
### `offsetX`
22+
23+
The offset on the x-axis. This can be positive or negative. A positive value indicates right and negative indicates left.
24+
25+
| Type | Optional |
26+
| ---------------- | -------- |
27+
| number \| string | No |
28+
29+
### `offsetY`
30+
31+
The offset on the y-axis. This can be positive or negative. A positive value indicates up and negative indicates down.
32+
33+
| Type | Optional |
34+
| ---------------- | -------- |
35+
| number \| string | No |
36+
37+
### `standardDeviation`
38+
39+
Represents the standard deviation used in the [Guassian blur](https://en.wikipedia.org/wiki/Gaussian_blur) algorithm. The larger the value the blurrier the shadow is. Only non-negative values are valid. The default is 0.
40+
41+
| Type | Optional |
42+
| --------------- | -------- |
43+
| numer \| string | Yes |
44+
45+
### `color`
46+
47+
The color of the shadow. The default is `black`.
48+
49+
| Type | Optional |
50+
| -------------------- | -------- |
51+
| [color](./colors.md) | Yes |
52+
53+
## Used by
54+
55+
- [`filter`](./view-style-props.md#filter)

docs/fabric-native-components-android.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ public class ReactWebViewPackage extends BaseReactPackage {
381381
public ReactModuleInfoProvider getReactModuleInfoProvider() {
382382
return new ReactModuleInfoProvider() {
383383
@Override
384-
public Map<String, ReactModuleInfo> get() {
384+
public Map<String, ReactModuleInfo> getReactModuleInfos() {
385385
Map<String, ReactModuleInfo> map = new HashMap<>();
386386
map.put(ReactWebViewManager.REACT_CLASS, new ReactModuleInfo(
387387
ReactWebViewManager.REACT_CLASS, // name

docs/fabric-native-components-ios.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,12 @@ open Demo.xcworkspace
6060
Podfile
6161
...
6262
Demo
63-
├── AppDelegate.h
64-
├── AppDelegate.mm
63+
├── AppDelegate.swift
6564
...
6665
// highlight-start
6766
├── RCTWebView.h
68-
── RCTWebView.mm
67+
── RCTWebView.mm
6968
// highlight-end
70-
└── main.m
7169
```
7270

7371
After creating the header file and the implementation file, you can start implementing them.

docs/hermes.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Hermes is used by default by React Native and no additional configuration is req
1515
## Bundled Hermes
1616

1717
React Native comes with a **bundled version** of Hermes.
18-
We building a version of Hermes for you whenever we release a new version of React Native. This will make sure you're consuming a version of Hermes which is fully compatible with the version of React Native you're using.
18+
We are building a version of Hermes for you whenever we release a new version of React Native. This will make sure you're consuming a version of Hermes which is fully compatible with the version of React Native you're using.
1919

2020
This change is fully transparent to users of React Native. You can still disable Hermes using the command described in this page.
2121
You can [read more about the technical implementation on this page](/architecture/bundled-hermes).

docs/images.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,38 @@ In some cases you might only want to display an image if it is already in the lo
173173

174174
See [CameraRoll](https://github.com/react-native-community/react-native-cameraroll) for an example of using local resources that are outside of `Images.xcassets`.
175175

176+
### Drawable resources
177+
178+
Android supports loading [drawable resources](https://developer.android.com/guide/topics/resources/drawable-resource) via the `xml` file type. This means you can use [vector drawables](https://developer.android.com/develop/ui/views/graphics/vector-drawable-resources) for rendering icons or [shape drawables](https://developer.android.com/guide/topics/resources/drawable-resource#Shape) for, well, drawing shapes! You can import and use these resource types the same as any other [static resource](#static-image-resources) or [hybrid resource](#images-from-hybrid-apps-resources). You have to specify image dimensions manually.
179+
180+
For static drawables that live alongside your JS code, use the `require` or `import` syntax (both work the same):
181+
182+
```tsx
183+
<Image
184+
source={require('./img/my_icon.xml')}
185+
style={{width: 40, height: 40}}
186+
/>
187+
```
188+
189+
For drawables included in the Android drawable folder (i.e. `res/drawable`), use the resource name without the extension:
190+
191+
```tsx
192+
<Image
193+
source={{uri: 'my_icon'}}
194+
style={{width: 40, height: 40}}
195+
/>
196+
```
197+
198+
The one key difference between drawable resources and other image types is that the asset must be referenced at compile-time of the Android application as Android needs to run the [Android Asset Packaging Tool (AAPT)](https://developer.android.com/tools/aapt2) to package the asset. Binary XML, the file format AAPT creates, cannot be loaded over the network by Metro. If you change the directory or name of an asset, you will need to rebuild the Android application each time.
199+
200+
#### Creating XML drawable resources
201+
202+
Android provides comprehensive documentation on each of the supported drawable resource types in its [Drawable resources](https://developer.android.com/guide/topics/resources/drawable-resource) guide, along with examples of raw XML files. You can utilize tools from Android Studio like the [Vector Asset Studio](https://developer.android.com/studio/write/vector-asset-studio) to create vector drawables from Scalable Vector Graphic (SVG) and Adobe Photoshop Document (PSD) files.
203+
204+
:::info
205+
You should try to avoid referencing other resources in the XML file you create if you want to treat your XML file as a static image resource (i.e. with an `import` or `require` statement). If you wish to utilize references to other drawables or attributes, like [color state lists](https://developer.android.com/guide/topics/resources/color-list-resource) or [dimension resources](https://developer.android.com/guide/topics/resources/more-resources#Dimension), you should include your drawable as a [hybrid resource](#images-from-hybrid-apps-resources) and import it by name.
206+
:::
207+
176208
### Best Camera Roll Image
177209

178210
iOS saves multiple sizes for the same image in your Camera Roll, it is very important to pick the one that's as close as possible for performance reasons. You wouldn't want to use the full quality 3264x2448 image as source when displaying a 200x200 thumbnail. If there's an exact match, React Native will pick it, otherwise it's going to use the first one that's at least 50% bigger in order to avoid blur when resizing from a close size. All of this is done by default so you don't have to worry about writing the tedious (and error prone) code to do it yourself.

docs/layout-props.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -513,6 +513,16 @@ See https://developer.mozilla.org/en-US/docs/Web/CSS/bottom for more details of
513513

514514
---
515515

516+
### `boxSizing`
517+
518+
`boxSizing` defines how the element's various sizing props (`width`, `height`, `minWidth`, `minHeight`, etc.) are computed. If `boxSizing` is `border-box`, these sizes apply to the border box of the element. If it is `content-box`, they apply to the content box of the element. The default value is `border-box`. The [web documentation](https://developer.mozilla.org/en-US/docs/Web/CSS/box-sizing) is a good source of information if you wish to learn more about how this prop works.
519+
520+
| Type | Required |
521+
| --------------------------------- | -------- |
522+
| enum('border-box', 'content-box') | No |
523+
524+
---
525+
516526
### `columnGap`
517527

518528
`columnGap` works like `column-gap` in CSS. Only pixel units are supported in React Native. See https://developer.mozilla.org/en-US/docs/Web/CSS/column-gap for more details.

docs/linking.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ In addition to `https`, you're likely also familiar with the `mailto` scheme. Wh
1313

1414
Like using the mailto scheme, it's possible to link to other applications by using custom url schemes. For example, when you get a **Magic Link** email from Slack, the **Launch Slack** button is an anchor tag with an href that looks something like: `slack://secret/magic-login/other-secret`. Like with Slack, you can tell the operating system that you want to handle a custom scheme. When the Slack app opens, it receives the URL that was used to open it. This is often referred to as deep linking. Read more about how to [get the deep link](#get-the-deep-link) into your app.
1515

16-
Custom URL scheme isn't the only way to open your application on mobile. You don't want to use a custom URL scheme in links in the email because then the links would be broken on desktop. Instead, you want to use a regular `https` links such as `https://www.myapp.io/records/1234546`. and on mobile you want that link open your app. Android calls it **Deep Links** (Universal Links - iOS).
16+
A custom URL scheme isn't the only way to open your application on mobile. For example, if you want to email someone a link to be opened on mobile, using a custom URL scheme isn't ideal because the user might open the email on a desktop, where the link wouldn't work. Instead, you should use standard `https` links, such as `https://www.myapp.io/records/1234546`. On mobile, these links can be configured to open your app. On Android, this feature is called **Deep Links**, while on iOS, it is known as **Universal Links**.
1717

1818
### Built-in URL Schemes
1919

0 commit comments

Comments
 (0)