Skip to content

Commit fa1f340

Browse files
committed
0.79
1 parent 73a3943 commit fa1f340

File tree

342 files changed

+49898
-1007
lines changed

Some content is hidden

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

342 files changed

+49898
-1007
lines changed

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

Lines changed: 217 additions & 185 deletions
Large diffs are not rendered by default.

cnwebsite/versioned_docs/version-0.78/_integration-with-existing-apps-ios.md

Lines changed: 217 additions & 185 deletions
Large diffs are not rendered by default.

cnwebsite/versioned_docs/version-0.78/platform.md

Lines changed: 66 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,33 @@ title: Platform
77

88
```SnackPlayer name=Platform%20API%20Example&supportedPlatforms=ios,android
99
import React from 'react';
10-
import { Platform, StyleSheet, Text, ScrollView } from 'react-native';
10+
import {Platform, StyleSheet, Text, ScrollView} from 'react-native';
11+
import {SafeAreaView, SafeAreaProvider} from 'react-native-safe-area-context';
1112
1213
const App = () => {
1314
return (
14-
<ScrollView contentContainerStyle={styles.container}>
15-
<Text>OS</Text>
16-
<Text style={styles.value}>{Platform.OS}</Text>
17-
<Text>OS Version</Text>
18-
<Text style={styles.value}>{Platform.Version}</Text>
19-
<Text>isTV</Text>
20-
<Text style={styles.value}>{Platform.isTV.toString()}</Text>
21-
{Platform.OS === 'ios' && <>
22-
<Text>isPad</Text>
23-
<Text style={styles.value}>{Platform.isPad.toString()}</Text>
24-
</>}
25-
<Text>Constants</Text>
26-
<Text style={styles.value}>
27-
{JSON.stringify(Platform.constants, null, 2)}
28-
</Text>
29-
</ScrollView>
15+
<SafeAreaProvider>
16+
<SafeAreaView>
17+
<ScrollView contentContainerStyle={styles.container}>
18+
<Text>OS</Text>
19+
<Text style={styles.value}>{Platform.OS}</Text>
20+
<Text>OS Version</Text>
21+
<Text style={styles.value}>{Platform.Version}</Text>
22+
<Text>isTV</Text>
23+
<Text style={styles.value}>{Platform.isTV.toString()}</Text>
24+
{Platform.OS === 'ios' && (
25+
<>
26+
<Text>isPad</Text>
27+
<Text style={styles.value}>{Platform.isPad.toString()}</Text>
28+
</>
29+
)}
30+
<Text>Constants</Text>
31+
<Text style={styles.value}>
32+
{JSON.stringify(Platform.constants, null, 2)}
33+
</Text>
34+
</ScrollView>
35+
</SafeAreaView>
36+
</SafeAreaProvider>
3037
);
3138
};
3239
@@ -39,8 +46,8 @@ const styles = StyleSheet.create({
3946
value: {
4047
fontWeight: '600',
4148
padding: 4,
42-
marginBottom: 8
43-
}
49+
marginBottom: 8,
50+
},
4451
});
4552
4653
export default App;
@@ -54,8 +61,8 @@ export default App;
5461

5562
### `constants`
5663

57-
```jsx
58-
Platform.constants;
64+
```tsx
65+
static constants: PlatformConstants;
5966
```
6067

6168
Returns an object which contains all available common and specific constants related to the platform.
@@ -84,8 +91,8 @@ Returns an object which contains all available common and specific constants rel
8491

8592
### `isPad` <div class="label ios">iOS</div>
8693

87-
```jsx
88-
Platform.isPad;
94+
```tsx
95+
static isPad: boolean;
8996
```
9097

9198
Returns a boolean which defines if device is an iPad.
@@ -98,8 +105,8 @@ Returns a boolean which defines if device is an iPad.
98105

99106
### `isTV`
100107

101-
```jsx
102-
Platform.isTV;
108+
```tsx
109+
static isTV: boolean;
103110
```
104111

105112
Returns a boolean which defines if device is a TV.
@@ -110,10 +117,24 @@ Returns a boolean which defines if device is a TV.
110117

111118
---
112119

120+
### `isVision`
121+
122+
```tsx
123+
static isVision: boolean;
124+
```
125+
126+
Returns a boolean which defines if device is an Apple Vision. _If you are using [Apple Vision Pro (Designed for iPad)](https://developer.apple.com/documentation/visionos/checking-whether-your-app-is-compatible-with-visionos) `isVision` will be `false` but `isPad` will be `true`_
127+
128+
| Type |
129+
| ------- |
130+
| boolean |
131+
132+
---
133+
113134
### `isTesting`
114135

115-
```jsx
116-
Platform.isTesting;
136+
```tsx
137+
static isTesting: boolean;
117138
```
118139

119140
Returns a boolean which defines if application is running in Developer Mode with testing flag set.
@@ -126,8 +147,8 @@ Returns a boolean which defines if application is running in Developer Mode with
126147

127148
### `OS`
128149

129-
```jsx
130-
static Platform.OS
150+
```tsx
151+
static OS: 'android' | 'ios';
131152
```
132153

133154
Returns string value representing the current OS.
@@ -140,8 +161,8 @@ Returns string value representing the current OS.
140161

141162
### `Version`
142163

143-
```jsx
144-
Platform.Version;
164+
```tsx
165+
static Version: 'number' | 'string';
145166
```
146167

147168
Returns the version of the OS.
@@ -154,8 +175,8 @@ Returns the version of the OS.
154175

155176
### `select()`
156177

157-
```jsx
158-
static select(config: object): any
178+
```tsx
179+
static select(config: Record<string, T>): T;
159180
```
160181

161182
Returns the most fitting value for the platform you are currently running on.
@@ -177,45 +198,45 @@ The `config` parameter is an object with the following keys:
177198

178199
**Example usage:**
179200

180-
```jsx
181-
import { Platform, StyleSheet } from 'react-native';
201+
```tsx
202+
import {Platform, StyleSheet} from 'react-native';
182203

183204
const styles = StyleSheet.create({
184205
container: {
185206
flex: 1,
186207
...Platform.select({
187208
android: {
188-
backgroundColor: 'green'
209+
backgroundColor: 'green',
189210
},
190211
ios: {
191-
backgroundColor: 'red'
212+
backgroundColor: 'red',
192213
},
193214
default: {
194215
// other platforms, web for example
195-
backgroundColor: 'blue'
196-
}
197-
})
198-
}
216+
backgroundColor: 'blue',
217+
},
218+
}),
219+
},
199220
});
200221
```
201222

202223
This will result in a container having `flex: 1` on all platforms, a green background color on Android, a red background color on iOS, and a blue background color on other platforms.
203224

204225
Since the value of the corresponding platform key can be of type `any`, [`select`](platform.md#select) method can also be used to return platform-specific components, like below:
205226

206-
```jsx
227+
```tsx
207228
const Component = Platform.select({
208229
ios: () => require('ComponentIOS'),
209-
android: () => require('ComponentAndroid')
230+
android: () => require('ComponentAndroid'),
210231
})();
211232

212233
<Component />;
213234
```
214235

215-
```jsx
236+
```tsx
216237
const Component = Platform.select({
217238
native: () => require('ComponentForNative'),
218-
default: () => require('ComponentForWeb')
239+
default: () => require('ComponentForWeb'),
219240
})();
220241

221242
<Component />;
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import React from "react";
2+
import IOSContent from "./fabric-native-components-ios.md";
3+
import AndroidContent from "./fabric-native-components-android.md";
4+
5+
export function FabricNativeComponentsIOS() {
6+
return <IOSContent />;
7+
}
8+
9+
export function FabricNativeComponentsAndroid() {
10+
return <AndroidContent />;
11+
}

0 commit comments

Comments
 (0)