@react-navigation/elements 1.3.18 → 1.4.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/Background.js +1 -1
- package/lib/commonjs/Background.js.map +1 -1
- package/lib/commonjs/Header/Header.js +9 -10
- package/lib/commonjs/Header/Header.js.map +1 -1
- package/lib/commonjs/Header/HeaderBackButton.js +9 -9
- package/lib/commonjs/Header/HeaderBackButton.js.map +1 -1
- package/lib/commonjs/Header/HeaderBackContext.js +4 -6
- package/lib/commonjs/Header/HeaderBackContext.js.map +1 -1
- package/lib/commonjs/Header/HeaderBackground.js +1 -1
- package/lib/commonjs/Header/HeaderBackground.js.map +1 -1
- package/lib/commonjs/Header/HeaderHeightContext.js +4 -6
- package/lib/commonjs/Header/HeaderHeightContext.js.map +1 -1
- package/lib/commonjs/Header/HeaderShownContext.js +4 -6
- package/lib/commonjs/Header/HeaderShownContext.js.map +1 -1
- package/lib/commonjs/Header/HeaderTitle.js +11 -11
- package/lib/commonjs/Header/HeaderTitle.js.map +1 -1
- package/lib/commonjs/Header/getDefaultHeaderHeight.js +1 -1
- package/lib/commonjs/Header/getDefaultHeaderHeight.js.map +1 -1
- package/lib/commonjs/Header/getHeaderTitle.js +1 -1
- package/lib/commonjs/Header/getHeaderTitle.js.map +1 -1
- package/lib/commonjs/Header/useHeaderHeight.js +3 -4
- package/lib/commonjs/Header/useHeaderHeight.js.map +1 -1
- package/lib/commonjs/MaskedView.android.js +3 -4
- package/lib/commonjs/MaskedView.android.js.map +1 -1
- package/lib/commonjs/MaskedView.ios.js +3 -4
- package/lib/commonjs/MaskedView.ios.js.map +1 -1
- package/lib/commonjs/MaskedView.js +1 -1
- package/lib/commonjs/MaskedView.js.map +1 -1
- package/lib/commonjs/MaskedViewNative.js +1 -1
- package/lib/commonjs/MaskedViewNative.js.map +1 -1
- package/lib/commonjs/MissingIcon.js +1 -1
- package/lib/commonjs/MissingIcon.js.map +1 -1
- package/lib/commonjs/PlatformPressable.js +1 -1
- package/lib/commonjs/PlatformPressable.js.map +1 -1
- package/lib/commonjs/ResourceSavingView.js +2 -2
- package/lib/commonjs/ResourceSavingView.js.map +1 -1
- package/lib/commonjs/SafeAreaProviderCompat.js +13 -14
- package/lib/commonjs/SafeAreaProviderCompat.js.map +1 -1
- package/lib/commonjs/Screen.js +11 -12
- package/lib/commonjs/Screen.js.map +1 -1
- package/lib/commonjs/getNamedContext.js +1 -1
- package/lib/commonjs/getNamedContext.js.map +1 -1
- package/lib/commonjs/index.js +34 -35
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/Background.js +1 -1
- package/lib/module/Background.js.map +1 -1
- package/lib/module/Header/Header.js +5 -5
- package/lib/module/Header/Header.js.map +1 -1
- package/lib/module/Header/HeaderBackButton.js +7 -6
- package/lib/module/Header/HeaderBackButton.js.map +1 -1
- package/lib/module/Header/HeaderBackContext.js +2 -3
- package/lib/module/Header/HeaderBackContext.js.map +1 -1
- package/lib/module/Header/HeaderBackground.js +1 -1
- package/lib/module/Header/HeaderBackground.js.map +1 -1
- package/lib/module/Header/HeaderHeightContext.js +2 -3
- package/lib/module/Header/HeaderHeightContext.js.map +1 -1
- package/lib/module/Header/HeaderShownContext.js +2 -3
- package/lib/module/Header/HeaderShownContext.js.map +1 -1
- package/lib/module/Header/HeaderTitle.js +11 -11
- package/lib/module/Header/HeaderTitle.js.map +1 -1
- package/lib/module/Header/getDefaultHeaderHeight.js +1 -1
- package/lib/module/Header/getDefaultHeaderHeight.js.map +1 -1
- package/lib/module/Header/getHeaderTitle.js +1 -1
- package/lib/module/Header/getHeaderTitle.js.map +1 -1
- package/lib/module/Header/useHeaderHeight.js +2 -2
- package/lib/module/Header/useHeaderHeight.js.map +1 -1
- package/lib/module/MaskedView.android.js +1 -1
- package/lib/module/MaskedView.android.js.map +1 -1
- package/lib/module/MaskedView.ios.js +1 -1
- package/lib/module/MaskedView.ios.js.map +1 -1
- package/lib/module/MaskedView.js +1 -1
- package/lib/module/MaskedView.js.map +1 -1
- package/lib/module/MaskedViewNative.js +1 -1
- package/lib/module/MaskedViewNative.js.map +1 -1
- package/lib/module/MissingIcon.js +1 -1
- package/lib/module/MissingIcon.js.map +1 -1
- package/lib/module/PlatformPressable.js +1 -1
- package/lib/module/PlatformPressable.js.map +1 -1
- package/lib/module/ResourceSavingView.js +1 -1
- package/lib/module/ResourceSavingView.js.map +1 -1
- package/lib/module/SafeAreaProviderCompat.js +13 -14
- package/lib/module/SafeAreaProviderCompat.js.map +1 -1
- package/lib/module/Screen.js +5 -5
- package/lib/module/Screen.js.map +1 -1
- package/lib/module/getNamedContext.js +1 -1
- package/lib/module/getNamedContext.js.map +1 -1
- package/lib/module/index.js +16 -16
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/src/Background.d.ts +1 -1
- package/lib/typescript/src/Background.d.ts.map +1 -1
- package/lib/typescript/src/Header/Header.d.ts +1 -1
- package/lib/typescript/src/Header/Header.d.ts.map +1 -1
- package/lib/typescript/src/Header/HeaderBackButton.d.ts +1 -1
- package/lib/typescript/src/Header/HeaderBackButton.d.ts.map +1 -1
- package/lib/typescript/src/Header/HeaderBackContext.d.ts +1 -2
- package/lib/typescript/src/Header/HeaderBackContext.d.ts.map +1 -1
- package/lib/typescript/src/Header/HeaderBackground.d.ts +1 -1
- package/lib/typescript/src/Header/HeaderBackground.d.ts.map +1 -1
- package/lib/typescript/src/Header/HeaderHeightContext.d.ts +1 -2
- package/lib/typescript/src/Header/HeaderHeightContext.d.ts.map +1 -1
- package/lib/typescript/src/Header/HeaderShownContext.d.ts +1 -2
- package/lib/typescript/src/Header/HeaderShownContext.d.ts.map +1 -1
- package/lib/typescript/src/Header/HeaderTitle.d.ts +2 -1
- package/lib/typescript/src/Header/HeaderTitle.d.ts.map +1 -1
- package/lib/typescript/src/Header/getDefaultHeaderHeight.d.ts +1 -1
- package/lib/typescript/src/Header/getDefaultHeaderHeight.d.ts.map +1 -1
- package/lib/typescript/src/Header/getHeaderTitle.d.ts +1 -1
- package/lib/typescript/src/Header/getHeaderTitle.d.ts.map +1 -1
- package/lib/typescript/src/Header/useHeaderHeight.d.ts +1 -1
- package/lib/typescript/src/Header/useHeaderHeight.d.ts.map +1 -1
- package/lib/typescript/src/MaskedView.android.d.ts +1 -1
- package/lib/typescript/src/MaskedView.android.d.ts.map +1 -1
- package/lib/typescript/src/MaskedView.d.ts +1 -1
- package/lib/typescript/src/MaskedView.d.ts.map +1 -1
- package/lib/typescript/src/MaskedView.ios.d.ts +1 -1
- package/lib/typescript/src/MaskedView.ios.d.ts.map +1 -1
- package/lib/typescript/src/MaskedViewNative.d.ts +1 -1
- package/lib/typescript/src/MaskedViewNative.d.ts.map +1 -1
- package/lib/typescript/src/MissingIcon.d.ts +1 -1
- package/lib/typescript/src/MissingIcon.d.ts.map +1 -1
- package/lib/typescript/src/PlatformPressable.d.ts +1 -1
- package/lib/typescript/src/PlatformPressable.d.ts.map +1 -1
- package/lib/typescript/src/ResourceSavingView.d.ts +1 -1
- package/lib/typescript/src/ResourceSavingView.d.ts.map +1 -1
- package/lib/typescript/src/SafeAreaProviderCompat.d.ts +3 -3
- package/lib/typescript/src/SafeAreaProviderCompat.d.ts.map +1 -1
- package/lib/typescript/src/Screen.d.ts +1 -1
- package/lib/typescript/src/Screen.d.ts.map +1 -1
- package/lib/typescript/src/getNamedContext.d.ts +1 -1
- package/lib/typescript/src/getNamedContext.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +16 -16
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/Background.tsx +1 -1
- package/src/Header/Header.tsx +5 -5
- package/src/Header/HeaderBackButton.tsx +6 -5
- package/src/Header/HeaderBackContext.tsx +2 -4
- package/src/Header/HeaderBackground.tsx +1 -1
- package/src/Header/HeaderHeightContext.tsx +2 -4
- package/src/Header/HeaderShownContext.tsx +2 -4
- package/src/Header/HeaderTitle.tsx +5 -7
- package/src/Header/getDefaultHeaderHeight.tsx +1 -1
- package/src/Header/getHeaderTitle.tsx +1 -1
- package/src/Header/useHeaderHeight.tsx +2 -2
- package/src/MaskedView.android.tsx +1 -1
- package/src/MaskedView.ios.tsx +1 -1
- package/src/MaskedView.tsx +1 -1
- package/src/MaskedViewNative.tsx +1 -1
- package/src/MissingIcon.tsx +1 -1
- package/src/PlatformPressable.tsx +1 -1
- package/src/ResourceSavingView.tsx +1 -1
- package/src/SafeAreaProviderCompat.tsx +13 -17
- package/src/Screen.tsx +5 -5
- package/src/getNamedContext.tsx +1 -1
- package/src/index.tsx +16 -16
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Screen.d.ts","sourceRoot":"","sources":["../../../src/Screen.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,cAAc,EAEd,aAAa,EACb,SAAS,EACV,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,SAAS,EAAoB,SAAS,EAAE,MAAM,cAAc,CAAC;AAWtE,KAAK,KAAK,GAAG;IACX,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,UAAU,EAAE,cAAc,CAAC,aAAa,CAAC,CAAC;IAC1C,KAAK,EAAE,SAAS,CAAC,aAAa,CAAC,CAAC;IAChC,MAAM,EAAE,KAAK,CAAC,SAAS,CAAC;IACxB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,CAAC;AAEF,
|
|
1
|
+
{"version":3,"file":"Screen.d.ts","sourceRoot":"","sources":["../../../src/Screen.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,cAAc,EAEd,aAAa,EACb,SAAS,EACV,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,SAAS,EAAoB,SAAS,EAAE,MAAM,cAAc,CAAC;AAWtE,KAAK,KAAK,GAAG;IACX,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,UAAU,EAAE,cAAc,CAAC,aAAa,CAAC,CAAC;IAC1C,KAAK,EAAE,SAAS,CAAC,aAAa,CAAC,CAAC;IAChC,MAAM,EAAE,KAAK,CAAC,SAAS,CAAC;IACxB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,CAAC;AAEF,wBAAgB,MAAM,CAAC,KAAK,EAAE,KAAK,eA2DlC"}
|
|
@@ -2,5 +2,5 @@ import * as React from 'react';
|
|
|
2
2
|
declare global {
|
|
3
3
|
var __react_navigation__elements_contexts: Map<string, React.Context<any>>;
|
|
4
4
|
}
|
|
5
|
-
export
|
|
5
|
+
export declare function getNamedContext<T>(name: string, initialValue: T): React.Context<T>;
|
|
6
6
|
//# sourceMappingURL=getNamedContext.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getNamedContext.d.ts","sourceRoot":"","sources":["../../../src/getNamedContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,OAAO,CAAC,MAAM,CAAC;IACb,IAAI,qCAAqC,EAAE,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC;CAC5E;AAKD,
|
|
1
|
+
{"version":3,"file":"getNamedContext.d.ts","sourceRoot":"","sources":["../../../src/getNamedContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,OAAO,CAAC,MAAM,CAAC;IACb,IAAI,qCAAqC,EAAE,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC;CAC5E;AAKD,wBAAgB,eAAe,CAAC,CAAC,EAC/B,IAAI,EAAE,MAAM,EACZ,YAAY,EAAE,CAAC,GACd,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAalB"}
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
5
|
-
export {
|
|
6
|
-
export {
|
|
7
|
-
export {
|
|
8
|
-
export {
|
|
9
|
-
export {
|
|
10
|
-
export {
|
|
11
|
-
export {
|
|
12
|
-
export {
|
|
13
|
-
export {
|
|
14
|
-
export {
|
|
15
|
-
export {
|
|
16
|
-
export {
|
|
1
|
+
export { Background } from './Background';
|
|
2
|
+
export { getDefaultHeaderHeight } from './Header/getDefaultHeaderHeight';
|
|
3
|
+
export { getHeaderTitle } from './Header/getHeaderTitle';
|
|
4
|
+
export { Header } from './Header/Header';
|
|
5
|
+
export { HeaderBackButton } from './Header/HeaderBackButton';
|
|
6
|
+
export { HeaderBackContext } from './Header/HeaderBackContext';
|
|
7
|
+
export { HeaderBackground } from './Header/HeaderBackground';
|
|
8
|
+
export { HeaderHeightContext } from './Header/HeaderHeightContext';
|
|
9
|
+
export { HeaderShownContext } from './Header/HeaderShownContext';
|
|
10
|
+
export { HeaderTitle } from './Header/HeaderTitle';
|
|
11
|
+
export { useHeaderHeight } from './Header/useHeaderHeight';
|
|
12
|
+
export { MissingIcon } from './MissingIcon';
|
|
13
|
+
export { PlatformPressable } from './PlatformPressable';
|
|
14
|
+
export { ResourceSavingView } from './ResourceSavingView';
|
|
15
|
+
export { SafeAreaProviderCompat } from './SafeAreaProviderCompat';
|
|
16
|
+
export { Screen } from './Screen';
|
|
17
17
|
export declare const Assets: any[];
|
|
18
18
|
export * from './types';
|
|
19
19
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AACzE,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,eAAO,MAAM,MAAM,OAKlB,CAAC;AAEF,cAAc,SAAS,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-navigation/elements",
|
|
3
3
|
"description": "UI Components for React Navigation",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.4.0-alpha.1",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react-native",
|
|
7
7
|
"react-navigation",
|
|
@@ -38,10 +38,10 @@
|
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@react-native-masked-view/masked-view": "0.2.9",
|
|
41
|
-
"@react-navigation/native": "^
|
|
41
|
+
"@react-navigation/native": "^7.0.0-alpha.2",
|
|
42
42
|
"@testing-library/react-native": "^11.5.0",
|
|
43
43
|
"@types/react": "~18.0.27",
|
|
44
|
-
"@types/react-native": "~0.
|
|
44
|
+
"@types/react-native": "~0.70.8",
|
|
45
45
|
"del-cli": "^5.0.0",
|
|
46
46
|
"react": "18.2.0",
|
|
47
47
|
"react-native": "0.71.8",
|
|
@@ -68,5 +68,5 @@
|
|
|
68
68
|
]
|
|
69
69
|
]
|
|
70
70
|
},
|
|
71
|
-
"gitHead": "
|
|
71
|
+
"gitHead": "36c8f091556157dab74d3483651bbcbd340762ff"
|
|
72
72
|
}
|
package/src/Background.tsx
CHANGED
package/src/Header/Header.tsx
CHANGED
|
@@ -6,10 +6,10 @@ import {
|
|
|
6
6
|
} from 'react-native-safe-area-context';
|
|
7
7
|
|
|
8
8
|
import type { HeaderOptions, Layout } from '../types';
|
|
9
|
-
import getDefaultHeaderHeight from './getDefaultHeaderHeight';
|
|
10
|
-
import HeaderBackground from './HeaderBackground';
|
|
11
|
-
import HeaderShownContext from './HeaderShownContext';
|
|
12
|
-
import HeaderTitle from './HeaderTitle';
|
|
9
|
+
import { getDefaultHeaderHeight } from './getDefaultHeaderHeight';
|
|
10
|
+
import { HeaderBackground } from './HeaderBackground';
|
|
11
|
+
import { HeaderShownContext } from './HeaderShownContext';
|
|
12
|
+
import { HeaderTitle } from './HeaderTitle';
|
|
13
13
|
|
|
14
14
|
type Props = HeaderOptions & {
|
|
15
15
|
/**
|
|
@@ -42,7 +42,7 @@ const warnIfHeaderStylesDefined = (styles: Record<string, any>) => {
|
|
|
42
42
|
});
|
|
43
43
|
};
|
|
44
44
|
|
|
45
|
-
export
|
|
45
|
+
export function Header(props: Props) {
|
|
46
46
|
const insets = useSafeAreaInsets();
|
|
47
47
|
const frame = useSafeAreaFrame();
|
|
48
48
|
|
|
@@ -10,11 +10,11 @@ import {
|
|
|
10
10
|
View,
|
|
11
11
|
} from 'react-native';
|
|
12
12
|
|
|
13
|
-
import MaskedView from '../MaskedView';
|
|
14
|
-
import PlatformPressable from '../PlatformPressable';
|
|
13
|
+
import { MaskedView } from '../MaskedView';
|
|
14
|
+
import { PlatformPressable } from '../PlatformPressable';
|
|
15
15
|
import type { HeaderBackButtonProps } from '../types';
|
|
16
16
|
|
|
17
|
-
export
|
|
17
|
+
export function HeaderBackButton({
|
|
18
18
|
disabled,
|
|
19
19
|
allowFontScaling,
|
|
20
20
|
backImage,
|
|
@@ -33,7 +33,7 @@ export default function HeaderBackButton({
|
|
|
33
33
|
testID,
|
|
34
34
|
style,
|
|
35
35
|
}: HeaderBackButtonProps) {
|
|
36
|
-
const { colors } = useTheme();
|
|
36
|
+
const { colors, fonts } = useTheme();
|
|
37
37
|
|
|
38
38
|
const [initialLabelWidth, setInitialLabelWidth] = React.useState<
|
|
39
39
|
undefined | number
|
|
@@ -106,8 +106,9 @@ export default function HeaderBackButton({
|
|
|
106
106
|
leftLabelText === label ? handleLabelLayout : undefined
|
|
107
107
|
}
|
|
108
108
|
style={[
|
|
109
|
-
styles.label,
|
|
110
109
|
tintColor ? { color: tintColor } : null,
|
|
110
|
+
fonts.regular,
|
|
111
|
+
styles.label,
|
|
111
112
|
labelStyle,
|
|
112
113
|
]}
|
|
113
114
|
numberOfLines={1}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import getNamedContext from '../getNamedContext';
|
|
1
|
+
import { getNamedContext } from '../getNamedContext';
|
|
2
2
|
|
|
3
|
-
const HeaderBackContext = getNamedContext<{ title: string } | undefined>(
|
|
3
|
+
export const HeaderBackContext = getNamedContext<{ title: string } | undefined>(
|
|
4
4
|
'HeaderBackContext',
|
|
5
5
|
undefined
|
|
6
6
|
);
|
|
7
|
-
|
|
8
|
-
export default HeaderBackContext;
|
|
@@ -14,7 +14,7 @@ type Props = Omit<ViewProps, 'style'> & {
|
|
|
14
14
|
children?: React.ReactNode;
|
|
15
15
|
};
|
|
16
16
|
|
|
17
|
-
export
|
|
17
|
+
export function HeaderBackground({ style, ...rest }: Props) {
|
|
18
18
|
const { colors } = useTheme();
|
|
19
19
|
|
|
20
20
|
return (
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import getNamedContext from '../getNamedContext';
|
|
1
|
+
import { getNamedContext } from '../getNamedContext';
|
|
2
2
|
|
|
3
|
-
const HeaderHeightContext = getNamedContext<number | undefined>(
|
|
3
|
+
export const HeaderHeightContext = getNamedContext<number | undefined>(
|
|
4
4
|
'HeaderHeightContext',
|
|
5
5
|
undefined
|
|
6
6
|
);
|
|
7
|
-
|
|
8
|
-
export default HeaderHeightContext;
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import getNamedContext from '../getNamedContext';
|
|
1
|
+
import { getNamedContext } from '../getNamedContext';
|
|
2
2
|
|
|
3
|
-
const HeaderShownContext = getNamedContext('HeaderShownContext', false);
|
|
4
|
-
|
|
5
|
-
export default HeaderShownContext;
|
|
3
|
+
export const HeaderShownContext = getNamedContext('HeaderShownContext', false);
|
|
@@ -11,11 +11,12 @@ import {
|
|
|
11
11
|
|
|
12
12
|
type Props = Omit<TextProps, 'style'> & {
|
|
13
13
|
tintColor?: string;
|
|
14
|
+
children?: string;
|
|
14
15
|
style?: Animated.WithAnimatedValue<StyleProp<TextStyle>>;
|
|
15
16
|
};
|
|
16
17
|
|
|
17
|
-
export
|
|
18
|
-
const { colors } = useTheme();
|
|
18
|
+
export function HeaderTitle({ tintColor, style, ...rest }: Props) {
|
|
19
|
+
const { colors, fonts } = useTheme();
|
|
19
20
|
|
|
20
21
|
return (
|
|
21
22
|
<Animated.Text
|
|
@@ -24,8 +25,9 @@ export default function HeaderTitle({ tintColor, style, ...rest }: Props) {
|
|
|
24
25
|
numberOfLines={1}
|
|
25
26
|
{...rest}
|
|
26
27
|
style={[
|
|
27
|
-
styles.title,
|
|
28
28
|
{ color: tintColor === undefined ? colors.text : tintColor },
|
|
29
|
+
Platform.select({ ios: fonts.bold, default: fonts.medium }),
|
|
30
|
+
styles.title,
|
|
29
31
|
style,
|
|
30
32
|
]}
|
|
31
33
|
/>
|
|
@@ -36,16 +38,12 @@ const styles = StyleSheet.create({
|
|
|
36
38
|
title: Platform.select({
|
|
37
39
|
ios: {
|
|
38
40
|
fontSize: 17,
|
|
39
|
-
fontWeight: '600',
|
|
40
41
|
},
|
|
41
42
|
android: {
|
|
42
43
|
fontSize: 20,
|
|
43
|
-
fontFamily: 'sans-serif-medium',
|
|
44
|
-
fontWeight: 'normal',
|
|
45
44
|
},
|
|
46
45
|
default: {
|
|
47
46
|
fontSize: 18,
|
|
48
|
-
fontWeight: '500',
|
|
49
47
|
},
|
|
50
48
|
}),
|
|
51
49
|
});
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
|
|
3
|
-
import HeaderHeightContext from './HeaderHeightContext';
|
|
3
|
+
import { HeaderHeightContext } from './HeaderHeightContext';
|
|
4
4
|
|
|
5
|
-
export
|
|
5
|
+
export function useHeaderHeight() {
|
|
6
6
|
const height = React.useContext(HeaderHeightContext);
|
|
7
7
|
|
|
8
8
|
if (height === undefined) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { MaskedView } from './MaskedViewNative';
|
package/src/MaskedView.ios.tsx
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { MaskedView } from './MaskedViewNative';
|
package/src/MaskedView.tsx
CHANGED
package/src/MaskedViewNative.tsx
CHANGED
|
@@ -24,7 +24,7 @@ try {
|
|
|
24
24
|
const isMaskedViewAvailable =
|
|
25
25
|
UIManager.getViewManagerConfig('RNCMaskedView') != null;
|
|
26
26
|
|
|
27
|
-
export
|
|
27
|
+
export function MaskedView({ children, ...rest }: Props) {
|
|
28
28
|
if (isMaskedViewAvailable && RNCMaskedView) {
|
|
29
29
|
return <RNCMaskedView {...rest}>{children}</RNCMaskedView>;
|
|
30
30
|
}
|
package/src/MissingIcon.tsx
CHANGED
|
@@ -7,7 +7,7 @@ type Props = {
|
|
|
7
7
|
style?: StyleProp<TextStyle>;
|
|
8
8
|
};
|
|
9
9
|
|
|
10
|
-
export
|
|
10
|
+
export function MissingIcon({ color, size, style }: Props) {
|
|
11
11
|
return <Text style={[styles.icon, { color, fontSize: size }, style]}>⏷</Text>;
|
|
12
12
|
}
|
|
13
13
|
|
|
@@ -27,7 +27,7 @@ const ANDROID_SUPPORTS_RIPPLE =
|
|
|
27
27
|
/**
|
|
28
28
|
* PlatformPressable provides an abstraction on top of Pressable to handle platform differences.
|
|
29
29
|
*/
|
|
30
|
-
export
|
|
30
|
+
export function PlatformPressable({
|
|
31
31
|
onPressIn,
|
|
32
32
|
onPressOut,
|
|
33
33
|
android_ripple,
|
|
@@ -31,24 +31,20 @@ const initialMetrics =
|
|
|
31
31
|
}
|
|
32
32
|
: initialWindowMetrics;
|
|
33
33
|
|
|
34
|
-
export
|
|
34
|
+
export function SafeAreaProviderCompat({ children, style }: Props) {
|
|
35
|
+
const insets = React.useContext(SafeAreaInsetsContext);
|
|
36
|
+
|
|
37
|
+
if (insets) {
|
|
38
|
+
// If we already have insets, don't wrap the stack in another safe area provider
|
|
39
|
+
// This avoids an issue with updates at the cost of potentially incorrect values
|
|
40
|
+
// https://github.com/react-navigation/react-navigation/issues/174
|
|
41
|
+
return <View style={[styles.container, style]}>{children}</View>;
|
|
42
|
+
}
|
|
43
|
+
|
|
35
44
|
return (
|
|
36
|
-
<
|
|
37
|
-
{
|
|
38
|
-
|
|
39
|
-
// If we already have insets, don't wrap the stack in another safe area provider
|
|
40
|
-
// This avoids an issue with updates at the cost of potentially incorrect values
|
|
41
|
-
// https://github.com/react-navigation/react-navigation/issues/174
|
|
42
|
-
return <View style={[styles.container, style]}>{children}</View>;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
return (
|
|
46
|
-
<SafeAreaProvider initialMetrics={initialMetrics} style={style}>
|
|
47
|
-
{children}
|
|
48
|
-
</SafeAreaProvider>
|
|
49
|
-
);
|
|
50
|
-
}}
|
|
51
|
-
</SafeAreaInsetsContext.Consumer>
|
|
45
|
+
<SafeAreaProvider initialMetrics={initialMetrics} style={style}>
|
|
46
|
+
{children}
|
|
47
|
+
</SafeAreaProvider>
|
|
52
48
|
);
|
|
53
49
|
}
|
|
54
50
|
|
package/src/Screen.tsx
CHANGED
|
@@ -12,10 +12,10 @@ import {
|
|
|
12
12
|
useSafeAreaInsets,
|
|
13
13
|
} from 'react-native-safe-area-context';
|
|
14
14
|
|
|
15
|
-
import Background from './Background';
|
|
16
|
-
import getDefaultHeaderHeight from './Header/getDefaultHeaderHeight';
|
|
17
|
-
import HeaderHeightContext from './Header/HeaderHeightContext';
|
|
18
|
-
import HeaderShownContext from './Header/HeaderShownContext';
|
|
15
|
+
import { Background } from './Background';
|
|
16
|
+
import { getDefaultHeaderHeight } from './Header/getDefaultHeaderHeight';
|
|
17
|
+
import { HeaderHeightContext } from './Header/HeaderHeightContext';
|
|
18
|
+
import { HeaderShownContext } from './Header/HeaderShownContext';
|
|
19
19
|
|
|
20
20
|
type Props = {
|
|
21
21
|
focused: boolean;
|
|
@@ -30,7 +30,7 @@ type Props = {
|
|
|
30
30
|
children: React.ReactNode;
|
|
31
31
|
};
|
|
32
32
|
|
|
33
|
-
export
|
|
33
|
+
export function Screen(props: Props) {
|
|
34
34
|
const dimensions = useSafeAreaFrame();
|
|
35
35
|
const insets = useSafeAreaInsets();
|
|
36
36
|
|
package/src/getNamedContext.tsx
CHANGED
|
@@ -9,7 +9,7 @@ declare global {
|
|
|
9
9
|
// We use a global variable to keep our contexts so that we can reuse same contexts across packages
|
|
10
10
|
global[contexts] = global[contexts] ?? new Map<string, React.Context<any>>();
|
|
11
11
|
|
|
12
|
-
export
|
|
12
|
+
export function getNamedContext<T>(
|
|
13
13
|
name: string,
|
|
14
14
|
initialValue: T
|
|
15
15
|
): React.Context<T> {
|
package/src/index.tsx
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
5
|
-
export {
|
|
6
|
-
export {
|
|
7
|
-
export {
|
|
8
|
-
export {
|
|
9
|
-
export {
|
|
10
|
-
export {
|
|
11
|
-
export {
|
|
12
|
-
export {
|
|
13
|
-
export {
|
|
14
|
-
export {
|
|
15
|
-
export {
|
|
16
|
-
export {
|
|
1
|
+
export { Background } from './Background';
|
|
2
|
+
export { getDefaultHeaderHeight } from './Header/getDefaultHeaderHeight';
|
|
3
|
+
export { getHeaderTitle } from './Header/getHeaderTitle';
|
|
4
|
+
export { Header } from './Header/Header';
|
|
5
|
+
export { HeaderBackButton } from './Header/HeaderBackButton';
|
|
6
|
+
export { HeaderBackContext } from './Header/HeaderBackContext';
|
|
7
|
+
export { HeaderBackground } from './Header/HeaderBackground';
|
|
8
|
+
export { HeaderHeightContext } from './Header/HeaderHeightContext';
|
|
9
|
+
export { HeaderShownContext } from './Header/HeaderShownContext';
|
|
10
|
+
export { HeaderTitle } from './Header/HeaderTitle';
|
|
11
|
+
export { useHeaderHeight } from './Header/useHeaderHeight';
|
|
12
|
+
export { MissingIcon } from './MissingIcon';
|
|
13
|
+
export { PlatformPressable } from './PlatformPressable';
|
|
14
|
+
export { ResourceSavingView } from './ResourceSavingView';
|
|
15
|
+
export { SafeAreaProviderCompat } from './SafeAreaProviderCompat';
|
|
16
|
+
export { Screen } from './Screen';
|
|
17
17
|
|
|
18
18
|
export const Assets = [
|
|
19
19
|
// eslint-disable-next-line import/no-commonjs
|