@react-native-ohos/react-native-safe-area-context 5.1.1-rc.1 → 5.1.1-rc.3

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.
Files changed (46) hide show
  1. package/README.md +3 -3
  2. package/harmony/safe_area/oh-package.json5 +1 -1
  3. package/harmony/safe_area/src/main/cpp/SafeAreaViewComponentInstance.cpp +29 -8
  4. package/harmony/safe_area.har +0 -0
  5. package/lib/commonjs/SafeAreaView.js +28 -3
  6. package/lib/commonjs/SafeAreaView.js.map +1 -1
  7. package/lib/commonjs/index.js +23 -0
  8. package/lib/commonjs/index.js.map +1 -1
  9. package/lib/commonjs/package.json +1 -0
  10. package/lib/commonjs/specs/NativeSafeAreaContext.js +23 -0
  11. package/lib/commonjs/specs/NativeSafeAreaContext.js.map +1 -1
  12. package/lib/commonjs/specs/NativeSafeAreaProvider.js +23 -0
  13. package/lib/commonjs/specs/NativeSafeAreaProvider.js.map +1 -1
  14. package/lib/commonjs/specs/NativeSafeAreaView.js +23 -0
  15. package/lib/commonjs/specs/NativeSafeAreaView.js.map +1 -1
  16. package/lib/module/SafeArea.types.js +2 -0
  17. package/lib/module/SafeAreaView.js +29 -3
  18. package/lib/module/SafeAreaView.js.map +1 -1
  19. package/lib/module/index.js +24 -0
  20. package/lib/module/index.js.map +1 -1
  21. package/lib/module/specs/NativeSafeAreaContext.js +25 -0
  22. package/lib/module/specs/NativeSafeAreaContext.js.map +1 -1
  23. package/lib/module/specs/NativeSafeAreaProvider.js +26 -0
  24. package/lib/module/specs/NativeSafeAreaProvider.js.map +1 -1
  25. package/lib/module/specs/NativeSafeAreaView.js +25 -0
  26. package/lib/module/specs/NativeSafeAreaView.js.map +1 -1
  27. package/lib/typescript/SafeArea.types.d.ts +23 -0
  28. package/lib/typescript/SafeArea.types.d.ts.map +1 -1
  29. package/lib/typescript/SafeAreaView.d.ts +23 -0
  30. package/lib/typescript/SafeAreaView.d.ts.map +1 -1
  31. package/lib/typescript/index.d.ts.map +1 -1
  32. package/lib/typescript/specs/NativeSafeAreaContext.d.ts +23 -0
  33. package/lib/typescript/specs/NativeSafeAreaContext.d.ts.map +1 -1
  34. package/lib/typescript/specs/NativeSafeAreaProvider.d.ts +23 -0
  35. package/lib/typescript/specs/NativeSafeAreaProvider.d.ts.map +1 -1
  36. package/lib/typescript/specs/NativeSafeAreaView.d.ts.map +1 -1
  37. package/package.json +3 -3
  38. package/src/SafeArea.types.ts +23 -0
  39. package/src/SafeAreaView.tsx +23 -0
  40. package/src/index.tsx +23 -0
  41. package/src/specs/NativeSafeAreaContext.ts +23 -0
  42. package/src/specs/NativeSafeAreaProvider.ts +23 -0
  43. package/src/specs/NativeSafeAreaView.ts +23 -0
  44. package/harmony/safe_area/LICENSE +0 -21
  45. package/harmony/safe_area/NOTICE +0 -33
  46. package/harmony/safe_area/README.md +0 -270
@@ -1,3 +1,26 @@
1
+ /**
2
+ * MIT License
3
+ *
4
+ * Copyright (C) 2025 Huawei Device Co., Ltd.
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ * of this software and associated documentation files (the "Software"), to deal
8
+ * in the Software without restriction, including without limitation the rights
9
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ * copies of the Software, and to permit persons to whom the Software is
11
+ * furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be included in all
14
+ * copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ * SOFTWARE.
23
+ */
1
24
  import * as React from 'react';
2
25
  import type { NativeSafeAreaViewProps } from './SafeArea.types';
3
26
  import type * as ReactNative from "react-native";
@@ -1 +1 @@
1
- {"version":3,"file":"SafeAreaView.d.ts","sourceRoot":"","sources":["../../src/SafeAreaView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAKV,uBAAuB,EACxB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,KAAK,KAAK,WAAW,MAAM,cAAc,CAAC;AAUjD,MAAM,MAAM,iBAAiB,GAAG,uBAAuB,CAAC;AAsBxD,eAAO,MAAM,YAAY,wLA+JvB,CAAC"}
1
+ {"version":3,"file":"SafeAreaView.d.ts","sourceRoot":"","sources":["../../src/SafeAreaView.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAKV,uBAAuB,EACxB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,KAAK,KAAK,WAAW,MAAM,cAAc,CAAC;AAUjD,MAAM,MAAM,iBAAiB,GAAG,uBAAuB,CAAC;AAsBxD,eAAO,MAAM,YAAY,wLA+JvB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AAEA,cAAc,oDAAoD,CAAC;AACnE,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mDAAmD,CAAC;AAClE,cAAc,oDAAoD,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AAyBA,cAAc,oDAAoD,CAAC;AACnE,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mDAAmD,CAAC;AAClE,cAAc,oDAAoD,CAAC"}
@@ -1,3 +1,26 @@
1
+ /**
2
+ * MIT License
3
+ *
4
+ * Copyright (C) 2025 Huawei Device Co., Ltd.
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ * of this software and associated documentation files (the "Software"), to deal
8
+ * in the Software without restriction, including without limitation the rights
9
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ * copies of the Software, and to permit persons to whom the Software is
11
+ * furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be included in all
14
+ * copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ * SOFTWARE.
23
+ */
1
24
  import { TurboModule } from 'react-native';
2
25
  import type { Double } from 'react-native/Libraries/Types/CodegenTypes';
3
26
  export interface Spec extends TurboModule {
@@ -1 +1 @@
1
- {"version":3,"file":"NativeSafeAreaContext.d.ts","sourceRoot":"","sources":["../../../src/specs/NativeSafeAreaContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAuB,MAAM,cAAc,CAAC;AAChE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AAExE,MAAM,WAAW,IAAK,SAAQ,WAAW;IACvC,YAAY,EAAE,MAAM;QAClB,oBAAoB,CAAC,EAAE;YACrB,MAAM,EAAE;gBACN,GAAG,EAAE,MAAM,CAAC;gBACZ,KAAK,EAAE,MAAM,CAAC;gBACd,MAAM,EAAE,MAAM,CAAC;gBACf,IAAI,EAAE,MAAM,CAAC;aACd,CAAC;YACF,KAAK,EAAE;gBACL,CAAC,EAAE,MAAM,CAAC;gBACV,CAAC,EAAE,MAAM,CAAC;gBACV,KAAK,EAAE,MAAM,CAAC;gBACd,MAAM,EAAE,MAAM,CAAC;aAChB,CAAC;SACH,CAAC;KACH,CAAC;CACH;;AAED,wBAAmE"}
1
+ {"version":3,"file":"NativeSafeAreaContext.d.ts","sourceRoot":"","sources":["../../../src/specs/NativeSafeAreaContext.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,OAAO,EAAE,WAAW,EAAuB,MAAM,cAAc,CAAC;AAChE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AAExE,MAAM,WAAW,IAAK,SAAQ,WAAW;IACvC,YAAY,EAAE,MAAM;QAClB,oBAAoB,CAAC,EAAE;YACrB,MAAM,EAAE;gBACN,GAAG,EAAE,MAAM,CAAC;gBACZ,KAAK,EAAE,MAAM,CAAC;gBACd,MAAM,EAAE,MAAM,CAAC;gBACf,IAAI,EAAE,MAAM,CAAC;aACd,CAAC;YACF,KAAK,EAAE;gBACL,CAAC,EAAE,MAAM,CAAC;gBACV,CAAC,EAAE,MAAM,CAAC;gBACV,KAAK,EAAE,MAAM,CAAC;gBACd,MAAM,EAAE,MAAM,CAAC;aAChB,CAAC;SACH,CAAC;KACH,CAAC;CACH;;AAED,wBAAmE"}
@@ -1,3 +1,26 @@
1
+ /**
2
+ * MIT License
3
+ *
4
+ * Copyright (C) 2025 Huawei Device Co., Ltd.
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ * of this software and associated documentation files (the "Software"), to deal
8
+ * in the Software without restriction, including without limitation the rights
9
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ * copies of the Software, and to permit persons to whom the Software is
11
+ * furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be included in all
14
+ * copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ * SOFTWARE.
23
+ */
1
24
  import type { DirectEventHandler, Double } from 'react-native/Libraries/Types/CodegenTypes';
2
25
  import type { ViewProps, HostComponent } from 'react-native';
3
26
  export type Event = Readonly<{
@@ -1 +1 @@
1
- {"version":3,"file":"NativeSafeAreaProvider.d.ts","sourceRoot":"","sources":["../../../src/specs/NativeSafeAreaProvider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,kBAAkB,EAClB,MAAM,EACP,MAAM,2CAA2C,CAAC;AAEnD,OAAO,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7D,MAAM,MAAM,KAAK,GAAG,QAAQ,CAAC;IAC3B,MAAM,EAAE,QAAQ,CAAC;QACf,GAAG,EAAE,MAAM,CAAC;QACZ,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,MAAM,CAAC;QACf,IAAI,EAAE,MAAM,CAAC;KACd,CAAC,CAAC;IACH,KAAK,EAAE,QAAQ,CAAC;QACd,CAAC,EAAE,MAAM,CAAC;QACV,CAAC,EAAE,MAAM,CAAC;QACV,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC,CAAC;CACJ,CAAC,CAAC;AAEH,MAAM,WAAW,WAAY,SAAQ,SAAS;IAC5C,cAAc,CAAC,EAAE,kBAAkB,CAAC,KAAK,CAAC,CAAC;CAC5C;wBAII,aAAa,CAAC,WAAW,CAAC;AAF/B,wBAEgC"}
1
+ {"version":3,"file":"NativeSafeAreaProvider.d.ts","sourceRoot":"","sources":["../../../src/specs/NativeSafeAreaProvider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,OAAO,KAAK,EACV,kBAAkB,EAClB,MAAM,EACP,MAAM,2CAA2C,CAAC;AAEnD,OAAO,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7D,MAAM,MAAM,KAAK,GAAG,QAAQ,CAAC;IAC3B,MAAM,EAAE,QAAQ,CAAC;QACf,GAAG,EAAE,MAAM,CAAC;QACZ,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,MAAM,CAAC;QACf,IAAI,EAAE,MAAM,CAAC;KACd,CAAC,CAAC;IACH,KAAK,EAAE,QAAQ,CAAC;QACd,CAAC,EAAE,MAAM,CAAC;QACV,CAAC,EAAE,MAAM,CAAC;QACV,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC,CAAC;CACJ,CAAC,CAAC;AAEH,MAAM,WAAW,WAAY,SAAQ,SAAS;IAC5C,cAAc,CAAC,EAAE,kBAAkB,CAAC,KAAK,CAAC,CAAC;CAC5C;wBAII,aAAa,CAAC,WAAW,CAAC;AAF/B,wBAEgC"}
@@ -1 +1 @@
1
- {"version":3,"file":"NativeSafeAreaView.d.ts","sourceRoot":"","sources":["../../../src/specs/NativeSafeAreaView.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,kBAAkB,EAAE,MAAM,2CAA2C,CAAC;AACxG,OAAO,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7D,MAAM,MAAM,0BAA0B,GAAG,QAAQ,CAAC;IAChD,uBAAuB,CAAC,EAAE;QACxB,GAAG,CAAC,EAAE,KAAK,CAAC;QACZ,IAAI,CAAC,EAAE,KAAK,CAAC;QACb,MAAM,CAAC,EAAE,KAAK,CAAA;QACd,KAAK,CAAC,EAAE,KAAK,CAAA;KACd,CAAC;CACH,CAAC,CAAA;AAEF,MAAM,WAAW,WAAY,SAAQ,SAAS;IAC5C,IAAI,CAAC,EAAE,WAAW,CAAC,SAAS,GAAG,QAAQ,EAAE,SAAS,CAAC,CAAC;IACpD,KAAK,CAAC,EAAE,QAAQ,CAAC;QACf,GAAG,EAAE,MAAM,CAAC;QACZ,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,MAAM,CAAC;QACf,IAAI,EAAE,MAAM,CAAC;KACd,CAAC,CAAC;IACH,cAAc,EAAE,OAAO,CAAC;IACxB,qBAAqB,EAAE,kBAAkB,CAAC,0BAA0B,CAAC,CAAC;CACvE;wBAIK,aAAa,CAAC,WAAW,CAAC;AAFhC,wBAEiC"}
1
+ {"version":3,"file":"NativeSafeAreaView.d.ts","sourceRoot":"","sources":["../../../src/specs/NativeSafeAreaView.ts"],"names":[],"mappings":"AAwBA,OAAO,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,kBAAkB,EAAE,MAAM,2CAA2C,CAAC;AACxG,OAAO,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7D,MAAM,MAAM,0BAA0B,GAAG,QAAQ,CAAC;IAChD,uBAAuB,CAAC,EAAE;QACxB,GAAG,CAAC,EAAE,KAAK,CAAC;QACZ,IAAI,CAAC,EAAE,KAAK,CAAC;QACb,MAAM,CAAC,EAAE,KAAK,CAAA;QACd,KAAK,CAAC,EAAE,KAAK,CAAA;KACd,CAAC;CACH,CAAC,CAAA;AAEF,MAAM,WAAW,WAAY,SAAQ,SAAS;IAC5C,IAAI,CAAC,EAAE,WAAW,CAAC,SAAS,GAAG,QAAQ,EAAE,SAAS,CAAC,CAAC;IACpD,KAAK,CAAC,EAAE,QAAQ,CAAC;QACf,GAAG,EAAE,MAAM,CAAC;QACZ,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,MAAM,CAAC;QACf,IAAI,EAAE,MAAM,CAAC;KACd,CAAC,CAAC;IACH,cAAc,EAAE,OAAO,CAAC;IACxB,qBAAqB,EAAE,kBAAkB,CAAC,0BAA0B,CAAC,CAAC;CACvE;wBAIK,aAAa,CAAC,WAAW,CAAC;AAFhC,wBAEiC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-native-ohos/react-native-safe-area-context",
3
- "version": "5.1.1-rc.1",
3
+ "version": "5.1.1-rc.3",
4
4
  "description": "A flexible way to handle safe area, also works on Android and web.",
5
5
  "main": "lib/commonjs/index.js",
6
6
  "module": "lib/module/index.js",
@@ -29,7 +29,7 @@
29
29
  "contributors": [
30
30
  "Evan Bacon <bacon@expo.io> (https://github.com/evanbacon)"
31
31
  ],
32
- "homepage": "https://github.com/th3rdwave/react-native-safe-area-context#readme",
32
+ "homepage": "https://gitcode.com/openharmony-sig/rntpc_react-native-safe-area-context/tree/br_rnoh0.77#readme",
33
33
  "license": "MIT",
34
34
  "scripts": {
35
35
  "start": "react-native start",
@@ -95,7 +95,7 @@
95
95
  },
96
96
  "repository": {
97
97
  "type": "git",
98
- "url": "https://github.com/react-native-oh-library/react-native-safe-area-context.git"
98
+ "url": "https://gitcode.com/openharmony-sig/rntpc_react-native-safe-area-context.git"
99
99
  },
100
100
  "jest": {
101
101
  "preset": "react-native",
@@ -1,3 +1,26 @@
1
+ /**
2
+ * MIT License
3
+ *
4
+ * Copyright (C) 2025 Huawei Device Co., Ltd.
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ * of this software and associated documentation files (the "Software"), to deal
8
+ * in the Software without restriction, including without limitation the rights
9
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ * copies of the Software, and to permit persons to whom the Software is
11
+ * furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be included in all
14
+ * copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ * SOFTWARE.
23
+ */
1
24
  import type * as React from 'react';
2
25
  import type { NativeSyntheticEvent, ViewProps } from 'react-native';
3
26
  import NativeSafeAreaView from './specs/NativeSafeAreaView';
@@ -1,3 +1,26 @@
1
+ /**
2
+ * MIT License
3
+ *
4
+ * Copyright (C) 2025 Huawei Device Co., Ltd.
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ * of this software and associated documentation files (the "Software"), to deal
8
+ * in the Software without restriction, including without limitation the rights
9
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ * copies of the Software, and to permit persons to whom the Software is
11
+ * furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be included in all
14
+ * copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ * SOFTWARE.
23
+ */
1
24
  import * as React from 'react';
2
25
  import type {
3
26
  Edge,
package/src/index.tsx CHANGED
@@ -1,3 +1,26 @@
1
+ /**
2
+ * MIT License
3
+ *
4
+ * Copyright (C) 2025 Huawei Device Co., Ltd.
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ * of this software and associated documentation files (the "Software"), to deal
8
+ * in the Software without restriction, including without limitation the rights
9
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ * copies of the Software, and to permit persons to whom the Software is
11
+ * furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be included in all
14
+ * copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ * SOFTWARE.
23
+ */
1
24
  'use client';
2
25
 
3
26
  export * from 'react-native-safe-area-context/src/SafeAreaContext';
@@ -1,3 +1,26 @@
1
+ /**
2
+ * MIT License
3
+ *
4
+ * Copyright (C) 2025 Huawei Device Co., Ltd.
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ * of this software and associated documentation files (the "Software"), to deal
8
+ * in the Software without restriction, including without limitation the rights
9
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ * copies of the Software, and to permit persons to whom the Software is
11
+ * furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be included in all
14
+ * copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ * SOFTWARE.
23
+ */
1
24
  import { TurboModule, TurboModuleRegistry } from 'react-native';
2
25
  import type { Double } from 'react-native/Libraries/Types/CodegenTypes';
3
26
 
@@ -1,3 +1,26 @@
1
+ /**
2
+ * MIT License
3
+ *
4
+ * Copyright (C) 2025 Huawei Device Co., Ltd.
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ * of this software and associated documentation files (the "Software"), to deal
8
+ * in the Software without restriction, including without limitation the rights
9
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ * copies of the Software, and to permit persons to whom the Software is
11
+ * furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be included in all
14
+ * copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ * SOFTWARE.
23
+ */
1
24
  import type {
2
25
  DirectEventHandler,
3
26
  Double,
@@ -1,3 +1,26 @@
1
+ /**
2
+ * MIT License
3
+ *
4
+ * Copyright (C) 2025 Huawei Device Co., Ltd.
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ * of this software and associated documentation files (the "Software"), to deal
8
+ * in the Software without restriction, including without limitation the rights
9
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ * copies of the Software, and to permit persons to whom the Software is
11
+ * furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be included in all
14
+ * copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ * SOFTWARE.
23
+ */
1
24
  import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
2
25
  import type { WithDefault, Float, DirectEventHandler } from 'react-native/Libraries/Types/CodegenTypes';
3
26
  import type { ViewProps, HostComponent } from 'react-native';
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2019 Th3rd Wave
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
@@ -1,33 +0,0 @@
1
- OPEN SOURCE SOFTWARE NOTICE
2
-
3
- Please note we provide an open source software notice for the third party open source software along with this software and/or this software component (in the following just “this SOFTWARE”). The open source software licenses are granted by the respective right holders.
4
-
5
- Warranty Disclaimer
6
- THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS.
7
-
8
- Copyright Notice and License Texts
9
-
10
- ----------------------------------------------------------------------
11
- Software: react-native-safe-area-context V5.1.0
12
-
13
- MIT License
14
-
15
- Copyright (c) 2019 Th3rd Wave
16
-
17
- Permission is hereby granted, free of charge, to any person obtaining a copy
18
- of this software and associated documentation files (the "Software"), to deal
19
- in the Software without restriction, including without limitation the rights
20
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
21
- copies of the Software, and to permit persons to whom the Software is
22
- furnished to do so, subject to the following conditions:
23
-
24
- The above copyright notice and this permission notice shall be included in all
25
- copies or substantial portions of the Software.
26
-
27
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
28
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
29
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
30
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
31
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
32
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
33
- SOFTWARE.
@@ -1,270 +0,0 @@
1
- > 模板版本:v0.0.1
2
-
3
- <p align="center">
4
- <h1 align="center"> <code>react-native-safe-area-context</code> </h1>
5
- </p>
6
- <p align="center">
7
- <a href="https://github.com/th3rdwave/react-native-safe-area-context">
8
- <img src="https://img.shields.io/badge/platforms-android%20%7C%20ios%20%7C%20web%20%7C%20macos%20%7C%20windows%20%7C%20harmony-lightgrey.svg" alt="Supported platforms" />
9
- </a>
10
- <a href="https://github.com/th3rdwave/react-native-safe-area-context/blob/main/LICENSE">
11
- <img src="https://img.shields.io/badge/license-MIT-green.svg" alt="License" />
12
- </a>
13
- </p>
14
-
15
- ## 安装与使用
16
-
17
- 进入到工程目录并输入以下命令:
18
-
19
- <!-- tabs:start -->
20
-
21
- **正在 npm 发布中,当前请先从仓库[Release](https://github.com/react-native-oh-library/react-native-safe-area-context/releases)中获取库 tgz,通过使用本地依赖来安装本库。**
22
-
23
- #### **yarn**
24
-
25
- ```bash
26
- yarn add xxx
27
- ```
28
-
29
- #### **npm**
30
-
31
- ```bash
32
- npm install xxx
33
- ```
34
-
35
- <!-- tabs:end -->
36
-
37
- 下面的代码展示了这个库的基本使用场景:
38
-
39
- ```js
40
- import React from "react";
41
- import { Text, View } from "react-native";
42
- import {
43
- SafeAreaProvider,
44
- SafeAreaView,
45
- initialWindowMetrics,
46
- } from "react-native-safe-area-context";
47
-
48
- const App = () => {
49
- return (
50
- <SafeAreaProvider initialMetrics={initialWindowMetrics}>
51
- <SafeAreaView style={{ flex: 1, backgroundColor: "red" }}>
52
- <View style={{ flex: 1 }}>
53
- <Text>hello</Text>
54
- </View>
55
- </SafeAreaView>
56
- </SafeAreaProvider>
57
- );
58
- };
59
-
60
- export default App;
61
- ```
62
-
63
- ## Link
64
-
65
- 目前鸿蒙暂不支持 AutoLink,所以 Link 步骤需要手动配置。
66
-
67
- 首先需要使用 DevEco Studio 打开项目里的鸿蒙工程 `harmony`
68
-
69
- ### 引入原生端代码
70
-
71
- 目前有两种方法:
72
-
73
- 1. 通过 har 包引入(在 IDE 完善相关功能后该方法会被遗弃,目前首选此方法);
74
- 2. 直接链接源码。
75
-
76
- 方法一:通过 har 包引入
77
- 打开 `entry/oh-package.json5`,添加以下依赖
78
-
79
- ```json
80
- "dependencies": {
81
- "rnoh": "file:../rnoh",
82
- "rnoh-safe-area": "file:../../node_modules/react-native-safe-area-context/harmony/safe_area.har"
83
- }
84
- ```
85
-
86
- 点击右上角的 `sync` 按钮
87
-
88
- 或者在终端执行:
89
-
90
- ```bash
91
- cd entry
92
- ohpm install
93
- ```
94
-
95
- 方法二:直接链接源码
96
- 打开 `entry/oh-package.json5`,添加以下依赖
97
-
98
- ```json
99
- "dependencies": {
100
- "rnoh": "file:../rnoh",
101
- "rnoh-safe-area": "file:../../node_modules/react-native-safe-area-context/harmony/safe_area"
102
- }
103
- ```
104
-
105
- 打开终端,执行:
106
-
107
- ```bash
108
- cd entry
109
- ohpm install --no-link
110
- ```
111
-
112
- ### 配置 CMakeLists 和引入 SafeAreaViewPackage
113
-
114
- 打开 `entry/src/main/cpp/CMakeLists.txt`,添加:
115
-
116
- ```diff
117
- project(rnapp)
118
- cmake_minimum_required(VERSION 3.4.1)
119
- set(RNOH_APP_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
120
- set(OH_MODULE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../oh_modules")
121
- set(RNOH_CPP_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../../../../react-native-harmony/harmony/cpp")
122
-
123
- add_subdirectory("${RNOH_CPP_DIR}" ./rn)
124
-
125
- # RNOH_BEGIN: add_package_subdirectories
126
- add_subdirectory("../../../../sample_package/src/main/cpp" ./sample-package)
127
- + add_subdirectory("${OH_MODULE_DIR}/rnoh-safe-area/src/main/cpp" ./safe_area)
128
- # RNOH_END: add_package_subdirectories
129
-
130
- add_library(rnoh_app SHARED
131
- "./PackageProvider.cpp"
132
- "${RNOH_CPP_DIR}/RNOHAppNapiBridge.cpp"
133
- )
134
-
135
- target_link_libraries(rnoh_app PUBLIC rnoh)
136
-
137
- # RNOH_BEGIN: link_packages
138
- target_link_libraries(rnoh_app PUBLIC rnoh_sample_package)
139
- + target_link_libraries(rnoh_app PUBLIC rnoh_safe_area)
140
- # RNOH_END: link_packages
141
- ```
142
-
143
- 打开 `entry/src/main/cpp/PackageProvider.cpp`,添加:
144
-
145
- ```diff
146
- #include "RNOH/PackageProvider.h"
147
- #include "SamplePackage.h"
148
- + #include "SafeAreaViewPackage.h"
149
-
150
- using namespace rnoh;
151
-
152
- std::vector<std::shared_ptr<Package>> PackageProvider::getPackages(Package::Context ctx) {
153
- return {
154
- std::make_shared<SamplePackage>(ctx),
155
- + std::make_shared<SafeAreaViewPackage>(ctx)
156
- };
157
- }
158
- ```
159
-
160
- ### 在 ArkTs 侧引入 react-native-safe-area-context 组件
161
-
162
- 打开 `entry/src/main/ets/pages/index.ets`,添加:
163
-
164
- ```diff
165
- import {
166
- RNApp,
167
- ComponentBuilderContext,
168
- RNAbility,
169
- AnyJSBundleProvider,
170
- MetroJSBundleProvider,
171
- ResourceJSBundleProvider,
172
- } from 'rnoh'
173
- import { SampleView, SAMPLE_VIEW_TYPE, PropsDisplayer } from "rnoh-sample-package"
174
- import { createRNPackages } from '../RNPackagesFactory'
175
- + import { SAFE_AREA_TYPE, RNCSafeAreaView, SAFE_AREA_PROVIDER_TYPE, SafeAreaProvider } from "rnoh-safe-area"
176
-
177
- @Builder
178
- function CustomComponentBuilder(ctx: ComponentBuilderContext) {
179
- if (ctx.descriptor.type === SAMPLE_VIEW_TYPE) {
180
- SampleView({
181
- ctx: ctx.rnohContext,
182
- tag: ctx.descriptor.tag,
183
- buildCustomComponent: CustomComponentBuilder
184
- })
185
- }
186
- + else if (ctx.descriptor.type === SAFE_AREA_TYPE) {
187
- + RNCSafeAreaView({
188
- + ctx: ctx.rnohContext,
189
- + tag: ctx.descriptor.tag,
190
- + buildCustomComponent: CustomComponentBuilder
191
- + })
192
- + }
193
- + else if (ctx.descriptor.type === SAFE_AREA_PROVIDER_TYPE) {
194
- + SafeAreaProvider({
195
- + ctx: ctx.rnohContext,
196
- + tag: ctx.descriptor.tag,
197
- + buildCustomComponent: CustomComponentBuilder
198
- + })
199
- + }
200
- ...
201
- }
202
- ...
203
- ```
204
-
205
- ### 在 ArkTs 侧引入 SafeAreaViewPackage
206
-
207
- 打开 `entry/src/main/ets/RNPackagesFactory.ts`,添加:
208
-
209
- ```diff
210
- import type {RNPackageContext, RNPackage} from 'rnoh/ts';
211
- import {SamplePackage} from 'rnoh-sample-package/ts';
212
- + import {SafeAreaViewPackage} from 'rnoh-safe-area/ts';
213
-
214
- export function createRNPackages(ctx: RNPackageContext): RNPackage[] {
215
- return [
216
- new SamplePackage(ctx),
217
- + new SafeAreaViewPackage(ctx)
218
- ];
219
- }
220
- ```
221
-
222
- ### 运行
223
-
224
- 点击右上角的 `sync` 按钮
225
-
226
- 或者在终端执行:
227
-
228
- ```bash
229
- cd entry
230
- ohpm install
231
- ```
232
-
233
- 然后编译、运行即可。
234
-
235
- ## 兼容性
236
-
237
- 要使用此库,需要使用正确的 React-Native 和 RNOH 版本。另外,还需要使用配套的 DevEco Studio 和 手机 ROM。
238
-
239
- 请到三方库相应的 Releases 发布地址查看 Release 配套的版本信息:[@react-native-oh-tpl/react-native-safe-area-context Releases](https://github.com/react-native-oh-library/react-native-safe-area-context/releases)
240
-
241
- ## 属性
242
-
243
- **组件 SafeAreaProvider**
244
-
245
- You should add `SafeAreaProvider` in your app root component. You may need to add it in other places like the root of modals and routes when using react-native-screens.
246
-
247
- Note that providers should not be inside a View that is animated with Animated or inside a ScrollView since it can cause very frequent updates.
248
-
249
- | 名称 | 说明 | 类型 | 是否必填 | 原库平台 | 鸿蒙支持 |
250
- | ---------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------ | -------- | -------- | -------- |
251
- | `Props` | Accepts all View props. Has a default style of {flex: 1}. | object | no | All | yes |
252
- | `initialMetrics` | Can be used to provide the initial value for frame and insets, this allows rendering immediatly. See optimization for more information on how to use this prop. | object | no | All | yes |
253
-
254
- **组件 SafeAreaView**
255
-
256
- `SafeAreaView` is a regular View component with the safe area insets applied as padding or margin.
257
-
258
- | 名称 | 说明 | 类型 | 是否必填 | 原库平台 | 鸿蒙支持 |
259
- | ------- | ----------------------------------------------------------------------------------------------- | ------ | -------- | -------- | -------- |
260
- | `Props` | Accepts all View props. Has a default style of {flex: 1}. | object | no | All | yes |
261
- | `edges` | Sets the edges to apply the safe area insets to. Defaults to all. | array | no | All | yes |
262
- | `mode` | Optional, padding (default) or margin. Apply the safe area to either the padding or the margin. | string | no | All | yes |
263
-
264
- ## 遗留问题
265
-
266
- ## 其他
267
-
268
- ## 开源协议
269
-
270
- 本项目基于 [The MIT License (MIT)](https://github.com/th3rdwave/react-native-safe-area-context/blob/main/LICENSE) ,请自由地享受和参与开源。