Browse Source

Initial project setup for ios

Janic Duplessis 4 years ago
parent
commit
01b6e20338
70 changed files with 8693 additions and 0 deletions
  1. 7
    0
      .eslintignore
  2. 46
    0
      .eslintrc.js
  3. 1
    0
      .gitattributes
  4. 60
    0
      .gitignore
  5. 6
    0
      .prettierrc
  6. 1
    0
      .watchmanconfig
  7. 45
    0
      android/build.gradle
  8. 6
    0
      android/gradle.properties
  9. BIN
      android/gradle/wrapper/gradle-wrapper.jar
  10. 5
    0
      android/gradle/wrapper/gradle-wrapper.properties
  11. 188
    0
      android/gradlew
  12. 100
    0
      android/gradlew.bat
  13. 6
    0
      android/licenseHeader.txt
  14. 10
    0
      android/src/main/AndroidManifest.xml
  15. 14
    0
      babel.config.js
  16. 59
    0
      example/.gitignore
  17. 114
    0
      example/App.js
  18. 55
    0
      example/android/app/_BUCK
  19. 210
    0
      example/android/app/build.gradle
  20. 19
    0
      example/android/app/build_defs.bzl
  21. 10
    0
      example/android/app/proguard-rules.pro
  22. 8
    0
      example/android/app/src/debug/AndroidManifest.xml
  23. 26
    0
      example/android/app/src/main/AndroidManifest.xml
  24. 15
    0
      example/android/app/src/main/java/com/safeareaviewexample/MainActivity.java
  25. 49
    0
      example/android/app/src/main/java/com/safeareaviewexample/MainApplication.java
  26. BIN
      example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
  27. BIN
      example/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
  28. BIN
      example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
  29. BIN
      example/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
  30. BIN
      example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
  31. BIN
      example/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
  32. BIN
      example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
  33. BIN
      example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
  34. BIN
      example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
  35. BIN
      example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
  36. 3
    0
      example/android/app/src/main/res/values/strings.xml
  37. 9
    0
      example/android/app/src/main/res/values/styles.xml
  38. 38
    0
      example/android/build.gradle
  39. 21
    0
      example/android/gradle.properties
  40. BIN
      example/android/gradle/wrapper/gradle-wrapper.jar
  41. 5
    0
      example/android/gradle/wrapper/gradle-wrapper.properties
  42. 188
    0
      example/android/gradlew
  43. 100
    0
      example/android/gradlew.bat
  44. 3
    0
      example/android/settings.gradle
  45. 4
    0
      example/app.json
  46. 9
    0
      example/index.js
  47. 30
    0
      example/ios/Podfile
  48. 187
    0
      example/ios/Podfile.lock
  49. 53
    0
      example/ios/SafeAreaViewExample-tvOS/Info.plist
  50. 24
    0
      example/ios/SafeAreaViewExample-tvOSTests/Info.plist
  51. 416
    0
      example/ios/SafeAreaViewExample.xcodeproj/project.pbxproj
  52. 129
    0
      example/ios/SafeAreaViewExample.xcodeproj/xcshareddata/xcschemes/SafeAreaViewExample.xcscheme
  53. 10
    0
      example/ios/SafeAreaViewExample.xcworkspace/contents.xcworkspacedata
  54. 8
    0
      example/ios/SafeAreaViewExample.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
  55. 15
    0
      example/ios/SafeAreaViewExample/AppDelegate.h
  56. 42
    0
      example/ios/SafeAreaViewExample/AppDelegate.m
  57. 42
    0
      example/ios/SafeAreaViewExample/Base.lproj/LaunchScreen.xib
  58. 38
    0
      example/ios/SafeAreaViewExample/Images.xcassets/AppIcon.appiconset/Contents.json
  59. 6
    0
      example/ios/SafeAreaViewExample/Images.xcassets/Contents.json
  60. 57
    0
      example/ios/SafeAreaViewExample/Info.plist
  61. 16
    0
      example/ios/SafeAreaViewExample/main.m
  62. 290
    0
      ios/SafeAreaView.xcodeproj/project.pbxproj
  63. 13
    0
      ios/SafeAreaView/RNCSafeAreaView.h
  64. 87
    0
      ios/SafeAreaView/RNCSafeAreaView.m
  65. 17
    0
      metro.config.js
  66. 51
    0
      package.json
  67. 226
    0
      src/index.ts
  68. 19
    0
      th3rdwave-safe-area-view.podspec
  69. 17
    0
      tsconfig.json
  70. 5460
    0
      yarn.lock

+ 7
- 0
.eslintignore View File

@@ -0,0 +1,7 @@
1
+typings
2
+node_modules
3
+example/android-bundle.js
4
+example/ios-bundle.js
5
+
6
+# generated by bob
7
+lib/

+ 46
- 0
.eslintrc.js View File

@@ -0,0 +1,46 @@
1
+/**
2
+ * Copyright (c) Facebook, Inc. and its affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ * @format
8
+ */
9
+
10
+const typescriptEslintRecommended = require('@typescript-eslint/eslint-plugin/dist/configs/recommended.json');
11
+const typescriptEslintPrettier = require('eslint-config-prettier/@typescript-eslint');
12
+
13
+module.exports = {
14
+  extends: ['@react-native-community'],
15
+  overrides: [
16
+    {
17
+      files: ['*.ts', '*.tsx'],
18
+      // Apply the recommended Typescript defaults and the prettier overrides to all Typescript files
19
+      rules: Object.assign(
20
+        typescriptEslintRecommended.rules,
21
+        typescriptEslintPrettier.rules,
22
+        {
23
+          '@typescript-eslint/explicit-member-accessibility': 'off',
24
+        },
25
+      ),
26
+    },
27
+    {
28
+      files: ['example/**/*.ts', 'example/**/*.tsx'],
29
+      rules: {
30
+        // Turn off rules which are useless and annoying for the example files files
31
+        '@typescript-eslint/explicit-function-return-type': 'off',
32
+        'react-native/no-inline-styles': 'off',
33
+      },
34
+    },
35
+    {
36
+      files: ['**/__tests__/**/*.ts', '**/*.spec.ts'],
37
+      env: {
38
+        jest: true,
39
+      },
40
+      rules: {
41
+        // Turn off rules which are useless and annoying for unit test files
42
+        '@typescript-eslint/explicit-function-return-type': 'off',
43
+      },
44
+    },
45
+  ],
46
+};

+ 1
- 0
.gitattributes View File

@@ -0,0 +1 @@
1
+*.pbxproj -text

+ 60
- 0
.gitignore View File

@@ -0,0 +1,60 @@
1
+
2
+# OSX
3
+#
4
+.DS_Store
5
+
6
+# node.js
7
+#
8
+node_modules/
9
+npm-debug.log
10
+yarn-error.log
11
+
12
+
13
+# Xcode
14
+#
15
+build/
16
+*.pbxuser
17
+!default.pbxuser
18
+*.mode1v3
19
+!default.mode1v3
20
+*.mode2v3
21
+!default.mode2v3
22
+*.perspectivev3
23
+!default.perspectivev3
24
+xcuserdata
25
+*.xccheckout
26
+*.moved-aside
27
+DerivedData
28
+*.hmap
29
+*.ipa
30
+*.xcuserstate
31
+project.xcworkspace
32
+
33
+
34
+# Android/IntelliJ
35
+#
36
+build/
37
+.idea
38
+.gradle
39
+local.properties
40
+*.iml
41
+
42
+# BUCK
43
+buck-out/
44
+\.buckd/
45
+debug.keystore
46
+
47
+# Editor config
48
+.vscode
49
+
50
+# Outputs
51
+coverage
52
+
53
+.tmp
54
+example/android-bundle.js
55
+example/ios-bundle.js
56
+index.android.bundle
57
+index.ios.bundle
58
+
59
+# generated by bob
60
+lib/

+ 6
- 0
.prettierrc View File

@@ -0,0 +1,6 @@
1
+{
2
+  "singleQuote": true,
3
+  "trailingComma": "all",
4
+  "bracketSpacing": true,
5
+  "jsxBracketSameLine": false
6
+}

+ 1
- 0
.watchmanconfig View File

@@ -0,0 +1 @@
1
+{}

+ 45
- 0
android/build.gradle View File

@@ -0,0 +1,45 @@
1
+buildscript {
2
+  repositories {
3
+    google()
4
+    jcenter()
5
+  }
6
+
7
+  dependencies {
8
+    //noinspection GradleDependency
9
+    classpath 'com.android.tools.build:gradle:3.2.1'
10
+  }
11
+}
12
+
13
+def getExtOrDefault(name) {
14
+  return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties['ReactNativeNetInfo_' + name]
15
+}
16
+
17
+def getExtOrIntegerDefault(name) {
18
+  return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties['ReactNativeNetInfo_' + name]).toInteger()
19
+}
20
+
21
+apply plugin: 'com.android.library'
22
+
23
+android {
24
+  compileSdkVersion getExtOrIntegerDefault('compileSdkVersion')
25
+  buildToolsVersion getExtOrDefault('buildToolsVersion')
26
+
27
+  defaultConfig {
28
+    minSdkVersion getExtOrIntegerDefault('minSdkVersion')
29
+    targetSdkVersion getExtOrIntegerDefault('targetSdkVersion')
30
+  }
31
+  lintOptions{
32
+    abortOnError false
33
+  }
34
+}
35
+
36
+repositories {
37
+  google()
38
+  jcenter()
39
+  mavenCentral()
40
+}
41
+
42
+dependencies {
43
+  //noinspection GradleDynamicVersion
44
+  api 'com.facebook.react:react-native:+'
45
+}

+ 6
- 0
android/gradle.properties View File

@@ -0,0 +1,6 @@
1
+ReactNativeNetInfo_compileSdkVersion=28
2
+ReactNativeNetInfo_buildToolsVersion=28.0.3
3
+ReactNativeNetInfo_targetSdkVersion=27
4
+ReactNativeNetInfo_minSdkVersion=16
5
+android.useAndroidX=true
6
+android.enableJetifier=true

BIN
android/gradle/wrapper/gradle-wrapper.jar View File


+ 5
- 0
android/gradle/wrapper/gradle-wrapper.properties View File

@@ -0,0 +1,5 @@
1
+distributionBase=GRADLE_USER_HOME
2
+distributionPath=wrapper/dists
3
+distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-bin.zip
4
+zipStoreBase=GRADLE_USER_HOME
5
+zipStorePath=wrapper/dists

+ 188
- 0
android/gradlew View File

@@ -0,0 +1,188 @@
1
+#!/usr/bin/env sh
2
+
3
+#
4
+# Copyright 2015 the original author or authors.
5
+#
6
+# Licensed under the Apache License, Version 2.0 (the "License");
7
+# you may not use this file except in compliance with the License.
8
+# You may obtain a copy of the License at
9
+#
10
+#      http://www.apache.org/licenses/LICENSE-2.0
11
+#
12
+# Unless required by applicable law or agreed to in writing, software
13
+# distributed under the License is distributed on an "AS IS" BASIS,
14
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+# See the License for the specific language governing permissions and
16
+# limitations under the License.
17
+#
18
+
19
+##############################################################################
20
+##
21
+##  Gradle start up script for UN*X
22
+##
23
+##############################################################################
24
+
25
+# Attempt to set APP_HOME
26
+# Resolve links: $0 may be a link
27
+PRG="$0"
28
+# Need this for relative symlinks.
29
+while [ -h "$PRG" ] ; do
30
+    ls=`ls -ld "$PRG"`
31
+    link=`expr "$ls" : '.*-> \(.*\)$'`
32
+    if expr "$link" : '/.*' > /dev/null; then
33
+        PRG="$link"
34
+    else
35
+        PRG=`dirname "$PRG"`"/$link"
36
+    fi
37
+done
38
+SAVED="`pwd`"
39
+cd "`dirname \"$PRG\"`/" >/dev/null
40
+APP_HOME="`pwd -P`"
41
+cd "$SAVED" >/dev/null
42
+
43
+APP_NAME="Gradle"
44
+APP_BASE_NAME=`basename "$0"`
45
+
46
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
47
+DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
48
+
49
+# Use the maximum available, or set MAX_FD != -1 to use that value.
50
+MAX_FD="maximum"
51
+
52
+warn () {
53
+    echo "$*"
54
+}
55
+
56
+die () {
57
+    echo
58
+    echo "$*"
59
+    echo
60
+    exit 1
61
+}
62
+
63
+# OS specific support (must be 'true' or 'false').
64
+cygwin=false
65
+msys=false
66
+darwin=false
67
+nonstop=false
68
+case "`uname`" in
69
+  CYGWIN* )
70
+    cygwin=true
71
+    ;;
72
+  Darwin* )
73
+    darwin=true
74
+    ;;
75
+  MINGW* )
76
+    msys=true
77
+    ;;
78
+  NONSTOP* )
79
+    nonstop=true
80
+    ;;
81
+esac
82
+
83
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
84
+
85
+# Determine the Java command to use to start the JVM.
86
+if [ -n "$JAVA_HOME" ] ; then
87
+    if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
88
+        # IBM's JDK on AIX uses strange locations for the executables
89
+        JAVACMD="$JAVA_HOME/jre/sh/java"
90
+    else
91
+        JAVACMD="$JAVA_HOME/bin/java"
92
+    fi
93
+    if [ ! -x "$JAVACMD" ] ; then
94
+        die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
95
+
96
+Please set the JAVA_HOME variable in your environment to match the
97
+location of your Java installation."
98
+    fi
99
+else
100
+    JAVACMD="java"
101
+    which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
102
+
103
+Please set the JAVA_HOME variable in your environment to match the
104
+location of your Java installation."
105
+fi
106
+
107
+# Increase the maximum file descriptors if we can.
108
+if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
109
+    MAX_FD_LIMIT=`ulimit -H -n`
110
+    if [ $? -eq 0 ] ; then
111
+        if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
112
+            MAX_FD="$MAX_FD_LIMIT"
113
+        fi
114
+        ulimit -n $MAX_FD
115
+        if [ $? -ne 0 ] ; then
116
+            warn "Could not set maximum file descriptor limit: $MAX_FD"
117
+        fi
118
+    else
119
+        warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
120
+    fi
121
+fi
122
+
123
+# For Darwin, add options to specify how the application appears in the dock
124
+if $darwin; then
125
+    GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
126
+fi
127
+
128
+# For Cygwin, switch paths to Windows format before running java
129
+if $cygwin ; then
130
+    APP_HOME=`cygpath --path --mixed "$APP_HOME"`
131
+    CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
132
+    JAVACMD=`cygpath --unix "$JAVACMD"`
133
+
134
+    # We build the pattern for arguments to be converted via cygpath
135
+    ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
136
+    SEP=""
137
+    for dir in $ROOTDIRSRAW ; do
138
+        ROOTDIRS="$ROOTDIRS$SEP$dir"
139
+        SEP="|"
140
+    done
141
+    OURCYGPATTERN="(^($ROOTDIRS))"
142
+    # Add a user-defined pattern to the cygpath arguments
143
+    if [ "$GRADLE_CYGPATTERN" != "" ] ; then
144
+        OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
145
+    fi
146
+    # Now convert the arguments - kludge to limit ourselves to /bin/sh
147
+    i=0
148
+    for arg in "$@" ; do
149
+        CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
150
+        CHECK2=`echo "$arg"|egrep -c "^-"`                                 ### Determine if an option
151
+
152
+        if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then                    ### Added a condition
153
+            eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
154
+        else
155
+            eval `echo args$i`="\"$arg\""
156
+        fi
157
+        i=$((i+1))
158
+    done
159
+    case $i in
160
+        (0) set -- ;;
161
+        (1) set -- "$args0" ;;
162
+        (2) set -- "$args0" "$args1" ;;
163
+        (3) set -- "$args0" "$args1" "$args2" ;;
164
+        (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
165
+        (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
166
+        (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
167
+        (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
168
+        (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
169
+        (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
170
+    esac
171
+fi
172
+
173
+# Escape application args
174
+save () {
175
+    for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
176
+    echo " "
177
+}
178
+APP_ARGS=$(save "$@")
179
+
180
+# Collect all arguments for the java command, following the shell quoting and substitution rules
181
+eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
182
+
183
+# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
184
+if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
185
+  cd "$(dirname "$0")"
186
+fi
187
+
188
+exec "$JAVACMD" "$@"

+ 100
- 0
android/gradlew.bat View File

@@ -0,0 +1,100 @@
1
+@rem
2
+@rem Copyright 2015 the original author or authors.
3
+@rem
4
+@rem Licensed under the Apache License, Version 2.0 (the "License");
5
+@rem you may not use this file except in compliance with the License.
6
+@rem You may obtain a copy of the License at
7
+@rem
8
+@rem      http://www.apache.org/licenses/LICENSE-2.0
9
+@rem
10
+@rem Unless required by applicable law or agreed to in writing, software
11
+@rem distributed under the License is distributed on an "AS IS" BASIS,
12
+@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+@rem See the License for the specific language governing permissions and
14
+@rem limitations under the License.
15
+@rem
16
+
17
+@if "%DEBUG%" == "" @echo off
18
+@rem ##########################################################################
19
+@rem
20
+@rem  Gradle startup script for Windows
21
+@rem
22
+@rem ##########################################################################
23
+
24
+@rem Set local scope for the variables with windows NT shell
25
+if "%OS%"=="Windows_NT" setlocal
26
+
27
+set DIRNAME=%~dp0
28
+if "%DIRNAME%" == "" set DIRNAME=.
29
+set APP_BASE_NAME=%~n0
30
+set APP_HOME=%DIRNAME%
31
+
32
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
33
+set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
34
+
35
+@rem Find java.exe
36
+if defined JAVA_HOME goto findJavaFromJavaHome
37
+
38
+set JAVA_EXE=java.exe
39
+%JAVA_EXE% -version >NUL 2>&1
40
+if "%ERRORLEVEL%" == "0" goto init
41
+
42
+echo.
43
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
44
+echo.
45
+echo Please set the JAVA_HOME variable in your environment to match the
46
+echo location of your Java installation.
47
+
48
+goto fail
49
+
50
+:findJavaFromJavaHome
51
+set JAVA_HOME=%JAVA_HOME:"=%
52
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
53
+
54
+if exist "%JAVA_EXE%" goto init
55
+
56
+echo.
57
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
58
+echo.
59
+echo Please set the JAVA_HOME variable in your environment to match the
60
+echo location of your Java installation.
61
+
62
+goto fail
63
+
64
+:init
65
+@rem Get command-line arguments, handling Windows variants
66
+
67
+if not "%OS%" == "Windows_NT" goto win9xME_args
68
+
69
+:win9xME_args
70
+@rem Slurp the command line arguments.
71
+set CMD_LINE_ARGS=
72
+set _SKIP=2
73
+
74
+:win9xME_args_slurp
75
+if "x%~1" == "x" goto execute
76
+
77
+set CMD_LINE_ARGS=%*
78
+
79
+:execute
80
+@rem Setup the command line
81
+
82
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
83
+
84
+@rem Execute Gradle
85
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
86
+
87
+:end
88
+@rem End local scope for the variables with windows NT shell
89
+if "%ERRORLEVEL%"=="0" goto mainEnd
90
+
91
+:fail
92
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
93
+rem the _cmd.exe /c_ return code!
94
+if  not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
95
+exit /b 1
96
+
97
+:mainEnd
98
+if "%OS%"=="Windows_NT" endlocal
99
+
100
+:omega

+ 6
- 0
android/licenseHeader.txt View File

@@ -0,0 +1,6 @@
1
+/**
2
+ * Copyright (c) Facebook, Inc. and its affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */

+ 10
- 0
android/src/main/AndroidManifest.xml View File

@@ -0,0 +1,10 @@
1
+
2
+<manifest
3
+	xmlns:android="http://schemas.android.com/apk/res/android"
4
+	package="com.reactnativecommunity.netinfo">
5
+
6
+	<uses-permission
7
+		android:name="android.permission.ACCESS_NETWORK_STATE" />
8
+
9
+</manifest>
10
+  

+ 14
- 0
babel.config.js View File

@@ -0,0 +1,14 @@
1
+module.exports = {
2
+  presets: ['module:metro-react-native-babel-preset'],
3
+  plugins: [
4
+    [
5
+      'module-resolver',
6
+      {
7
+        alias: {
8
+          '@th3rdwave/safe-area-view': './',
9
+        },
10
+        cwd: 'babelrc',
11
+      },
12
+    ],
13
+  ],
14
+};

+ 59
- 0
example/.gitignore View File

@@ -0,0 +1,59 @@
1
+# OSX
2
+#
3
+.DS_Store
4
+
5
+# Xcode
6
+#
7
+build/
8
+*.pbxuser
9
+!default.pbxuser
10
+*.mode1v3
11
+!default.mode1v3
12
+*.mode2v3
13
+!default.mode2v3
14
+*.perspectivev3
15
+!default.perspectivev3
16
+xcuserdata
17
+*.xccheckout
18
+*.moved-aside
19
+DerivedData
20
+*.hmap
21
+*.ipa
22
+*.xcuserstate
23
+project.xcworkspace
24
+
25
+# Android/IntelliJ
26
+#
27
+build/
28
+.idea
29
+.gradle
30
+local.properties
31
+*.iml
32
+
33
+# node.js
34
+#
35
+node_modules/
36
+npm-debug.log
37
+yarn-error.log
38
+
39
+# BUCK
40
+buck-out/
41
+\.buckd/
42
+*.keystore
43
+
44
+# fastlane
45
+#
46
+# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
47
+# screenshots whenever they are needed.
48
+# For more information about the recommended setup visit:
49
+# https://docs.fastlane.tools/best-practices/source-control/
50
+
51
+*/fastlane/report.xml
52
+*/fastlane/Preview.html
53
+*/fastlane/screenshots
54
+
55
+# Bundle artifact
56
+*.jsbundle
57
+
58
+# CocoaPods
59
+/ios/Pods/

+ 114
- 0
example/App.js View File

@@ -0,0 +1,114 @@
1
+/**
2
+ * Sample React Native App
3
+ * https://github.com/facebook/react-native
4
+ *
5
+ * @format
6
+ * @flow
7
+ */
8
+
9
+import React, {Fragment} from 'react';
10
+import {
11
+  SafeAreaView,
12
+  StyleSheet,
13
+  ScrollView,
14
+  View,
15
+  Text,
16
+  StatusBar,
17
+} from 'react-native';
18
+
19
+import {
20
+  Header,
21
+  LearnMoreLinks,
22
+  Colors,
23
+  DebugInstructions,
24
+  ReloadInstructions,
25
+} from 'react-native/Libraries/NewAppScreen';
26
+
27
+const App = () => {
28
+  return (
29
+    <Fragment>
30
+      <StatusBar barStyle="dark-content" />
31
+      <SafeAreaView>
32
+        <ScrollView
33
+          contentInsetAdjustmentBehavior="automatic"
34
+          style={styles.scrollView}>
35
+          <Header />
36
+          {global.HermesInternal == null ? null : (
37
+            <View style={styles.engine}>
38
+              <Text style={styles.footer}>Engine: Hermes</Text>
39
+            </View>
40
+          )}
41
+          <View style={styles.body}>
42
+            <View style={styles.sectionContainer}>
43
+              <Text style={styles.sectionTitle}>Step One</Text>
44
+              <Text style={styles.sectionDescription}>
45
+                Edit <Text style={styles.highlight}>App.js</Text> to change this
46
+                screen and then come back to see your edits.
47
+              </Text>
48
+            </View>
49
+            <View style={styles.sectionContainer}>
50
+              <Text style={styles.sectionTitle}>See Your Changes</Text>
51
+              <Text style={styles.sectionDescription}>
52
+                <ReloadInstructions />
53
+              </Text>
54
+            </View>
55
+            <View style={styles.sectionContainer}>
56
+              <Text style={styles.sectionTitle}>Debug</Text>
57
+              <Text style={styles.sectionDescription}>
58
+                <DebugInstructions />
59
+              </Text>
60
+            </View>
61
+            <View style={styles.sectionContainer}>
62
+              <Text style={styles.sectionTitle}>Learn More</Text>
63
+              <Text style={styles.sectionDescription}>
64
+                Read the docs to discover what to do next:
65
+              </Text>
66
+            </View>
67
+            <LearnMoreLinks />
68
+          </View>
69
+        </ScrollView>
70
+      </SafeAreaView>
71
+    </Fragment>
72
+  );
73
+};
74
+
75
+const styles = StyleSheet.create({
76
+  scrollView: {
77
+    backgroundColor: Colors.lighter,
78
+  },
79
+  engine: {
80
+    position: 'absolute',
81
+    right: 0,
82
+  },
83
+  body: {
84
+    backgroundColor: Colors.white,
85
+  },
86
+  sectionContainer: {
87
+    marginTop: 32,
88
+    paddingHorizontal: 24,
89
+  },
90
+  sectionTitle: {
91
+    fontSize: 24,
92
+    fontWeight: '600',
93
+    color: Colors.black,
94
+  },
95
+  sectionDescription: {
96
+    marginTop: 8,
97
+    fontSize: 18,
98
+    fontWeight: '400',
99
+    color: Colors.dark,
100
+  },
101
+  highlight: {
102
+    fontWeight: '700',
103
+  },
104
+  footer: {
105
+    color: Colors.dark,
106
+    fontSize: 12,
107
+    fontWeight: '600',
108
+    padding: 4,
109
+    paddingRight: 12,
110
+    textAlign: 'right',
111
+  },
112
+});
113
+
114
+export default App;

+ 55
- 0
example/android/app/_BUCK View File

@@ -0,0 +1,55 @@
1
+# To learn about Buck see [Docs](https://buckbuild.com/).
2
+# To run your application with Buck:
3
+# - install Buck
4
+# - `npm start` - to start the packager
5
+# - `cd android`
6
+# - `keytool -genkey -v -keystore keystores/debug.keystore -storepass android -alias androiddebugkey -keypass android -dname "CN=Android Debug,O=Android,C=US"`
7
+# - `./gradlew :app:copyDownloadableDepsToLibs` - make all Gradle compile dependencies available to Buck
8
+# - `buck install -r android/app` - compile, install and run application
9
+#
10
+
11
+load(":build_defs.bzl", "create_aar_targets", "create_jar_targets")
12
+
13
+lib_deps = []
14
+
15
+create_aar_targets(glob(["libs/*.aar"]))
16
+
17
+create_jar_targets(glob(["libs/*.jar"]))
18
+
19
+android_library(
20
+    name = "all-libs",
21
+    exported_deps = lib_deps,
22
+)
23
+
24
+android_library(
25
+    name = "app-code",
26
+    srcs = glob([
27
+        "src/main/java/**/*.java",
28
+    ]),
29
+    deps = [
30
+        ":all-libs",
31
+        ":build_config",
32
+        ":res",
33
+    ],
34
+)
35
+
36
+android_build_config(
37
+    name = "build_config",
38
+    package = "com.safeareaviewexample",
39
+)
40
+
41
+android_resource(
42
+    name = "res",
43
+    package = "com.safeareaviewexample",
44
+    res = "src/main/res",
45
+)
46
+
47
+android_binary(
48
+    name = "app",
49
+    keystore = "//android/keystores:debug",
50
+    manifest = "src/main/AndroidManifest.xml",
51
+    package_type = "debug",
52
+    deps = [
53
+        ":app-code",
54
+    ],
55
+)

+ 210
- 0
example/android/app/build.gradle View File

@@ -0,0 +1,210 @@
1
+apply plugin: "com.android.application"
2
+
3
+import com.android.build.OutputFile
4
+
5
+/**
6
+ * The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets
7
+ * and bundleReleaseJsAndAssets).
8
+ * These basically call `react-native bundle` with the correct arguments during the Android build
9
+ * cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the
10
+ * bundle directly from the development server. Below you can see all the possible configurations
11
+ * and their defaults. If you decide to add a configuration block, make sure to add it before the
12
+ * `apply from: "../../node_modules/react-native/react.gradle"` line.
13
+ *
14
+ * project.ext.react = [
15
+ *   // the name of the generated asset file containing your JS bundle
16
+ *   bundleAssetName: "index.android.bundle",
17
+ *
18
+ *   // the entry file for bundle generation
19
+ *   entryFile: "index.android.js",
20
+ *
21
+ *   // https://facebook.github.io/react-native/docs/performance#enable-the-ram-format
22
+ *   bundleCommand: "ram-bundle",
23
+ *
24
+ *   // whether to bundle JS and assets in debug mode
25
+ *   bundleInDebug: false,
26
+ *
27
+ *   // whether to bundle JS and assets in release mode
28
+ *   bundleInRelease: true,
29
+ *
30
+ *   // whether to bundle JS and assets in another build variant (if configured).
31
+ *   // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants
32
+ *   // The configuration property can be in the following formats
33
+ *   //         'bundleIn${productFlavor}${buildType}'
34
+ *   //         'bundleIn${buildType}'
35
+ *   // bundleInFreeDebug: true,
36
+ *   // bundleInPaidRelease: true,
37
+ *   // bundleInBeta: true,
38
+ *
39
+ *   // whether to disable dev mode in custom build variants (by default only disabled in release)
40
+ *   // for example: to disable dev mode in the staging build type (if configured)
41
+ *   devDisabledInStaging: true,
42
+ *   // The configuration property can be in the following formats
43
+ *   //         'devDisabledIn${productFlavor}${buildType}'
44
+ *   //         'devDisabledIn${buildType}'
45
+ *
46
+ *   // the root of your project, i.e. where "package.json" lives
47
+ *   root: "../../",
48
+ *
49
+ *   // where to put the JS bundle asset in debug mode
50
+ *   jsBundleDirDebug: "$buildDir/intermediates/assets/debug",
51
+ *
52
+ *   // where to put the JS bundle asset in release mode
53
+ *   jsBundleDirRelease: "$buildDir/intermediates/assets/release",
54
+ *
55
+ *   // where to put drawable resources / React Native assets, e.g. the ones you use via
56
+ *   // require('./image.png')), in debug mode
57
+ *   resourcesDirDebug: "$buildDir/intermediates/res/merged/debug",
58
+ *
59
+ *   // where to put drawable resources / React Native assets, e.g. the ones you use via
60
+ *   // require('./image.png')), in release mode
61
+ *   resourcesDirRelease: "$buildDir/intermediates/res/merged/release",
62
+ *
63
+ *   // by default the gradle tasks are skipped if none of the JS files or assets change; this means
64
+ *   // that we don't look at files in android/ or ios/ to determine whether the tasks are up to
65
+ *   // date; if you have any other folders that you want to ignore for performance reasons (gradle
66
+ *   // indexes the entire tree), add them here. Alternatively, if you have JS files in android/
67
+ *   // for example, you might want to remove it from here.
68
+ *   inputExcludes: ["android/**", "ios/**"],
69
+ *
70
+ *   // override which node gets called and with what additional arguments
71
+ *   nodeExecutableAndArgs: ["node"],
72
+ *
73
+ *   // supply additional arguments to the packager
74
+ *   extraPackagerArgs: []
75
+ * ]
76
+ */
77
+
78
+project.ext.react = [
79
+    entryFile: "index.js",
80
+    enableHermes: false,  // clean and rebuild if changing
81
+]
82
+
83
+apply from: "../../node_modules/react-native/react.gradle"
84
+
85
+/**
86
+ * Set this to true to create two separate APKs instead of one:
87
+ *   - An APK that only works on ARM devices
88
+ *   - An APK that only works on x86 devices
89
+ * The advantage is the size of the APK is reduced by about 4MB.
90
+ * Upload all the APKs to the Play Store and people will download
91
+ * the correct one based on the CPU architecture of their device.
92
+ */
93
+def enableSeparateBuildPerCPUArchitecture = false
94
+
95
+/**
96
+ * Run Proguard to shrink the Java bytecode in release builds.
97
+ */
98
+def enableProguardInReleaseBuilds = false
99
+
100
+/**
101
+ * The preferred build flavor of JavaScriptCore.
102
+ *
103
+ * For example, to use the international variant, you can use:
104
+ * `def jscFlavor = 'org.webkit:android-jsc-intl:+'`
105
+ *
106
+ * The international variant includes ICU i18n library and necessary data
107
+ * allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that
108
+ * give correct results when using with locales other than en-US.  Note that
109
+ * this variant is about 6MiB larger per architecture than default.
110
+ */
111
+def jscFlavor = 'org.webkit:android-jsc:+'
112
+
113
+/**
114
+ * Whether to enable the Hermes VM.
115
+ *
116
+ * This should be set on project.ext.react and mirrored here.  If it is not set
117
+ * on project.ext.react, JavaScript will not be compiled to Hermes Bytecode
118
+ * and the benefits of using Hermes will therefore be sharply reduced.
119
+ */
120
+def enableHermes = project.ext.react.get("enableHermes", false);
121
+
122
+android {
123
+    compileSdkVersion rootProject.ext.compileSdkVersion
124
+
125
+    compileOptions {
126
+        sourceCompatibility JavaVersion.VERSION_1_8
127
+        targetCompatibility JavaVersion.VERSION_1_8
128
+    }
129
+
130
+    defaultConfig {
131
+        applicationId "com.safeareaviewexample"
132
+        minSdkVersion rootProject.ext.minSdkVersion
133
+        targetSdkVersion rootProject.ext.targetSdkVersion
134
+        versionCode 1
135
+        versionName "1.0"
136
+    }
137
+    splits {
138
+        abi {
139
+            reset()
140
+            enable enableSeparateBuildPerCPUArchitecture
141
+            universalApk false  // If true, also generate a universal APK
142
+            include "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
143
+        }
144
+    }
145
+    signingConfigs {
146
+        debug {
147
+            storeFile file('debug.keystore')
148
+            storePassword 'android'
149
+            keyAlias 'androiddebugkey'
150
+            keyPassword 'android'
151
+        }
152
+    }
153
+    buildTypes {
154
+        debug {
155
+            signingConfig signingConfigs.debug
156
+        }
157
+        release {
158
+            // Caution! In production, you need to generate your own keystore file.
159
+            // see https://facebook.github.io/react-native/docs/signed-apk-android.
160
+            signingConfig signingConfigs.debug
161
+            minifyEnabled enableProguardInReleaseBuilds
162
+            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
163
+        }
164
+    }
165
+    // applicationVariants are e.g. debug, release
166
+    applicationVariants.all { variant ->
167
+        variant.outputs.each { output ->
168
+            // For each separate APK per architecture, set a unique version code as described here:
169
+            // https://developer.android.com/studio/build/configure-apk-splits.html
170
+            def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4]
171
+            def abi = output.getFilter(OutputFile.ABI)
172
+            if (abi != null) {  // null for the universal-debug, universal-release variants
173
+                output.versionCodeOverride =
174
+                        versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
175
+            }
176
+
177
+        }
178
+    }
179
+
180
+    packagingOptions {
181
+        pickFirst '**/armeabi-v7a/libc++_shared.so'
182
+        pickFirst '**/x86/libc++_shared.so'
183
+        pickFirst '**/arm64-v8a/libc++_shared.so'
184
+        pickFirst '**/x86_64/libc++_shared.so'
185
+        pickFirst '**/x86/libjsc.so'
186
+        pickFirst '**/armeabi-v7a/libjsc.so'
187
+    }
188
+}
189
+
190
+dependencies {
191
+    implementation fileTree(dir: "libs", include: ["*.jar"])
192
+    implementation "com.facebook.react:react-native:+"  // From node_modules
193
+
194
+    if (enableHermes) {
195
+      def hermesPath = "../../node_modules/hermesvm/android/";
196
+      debugImplementation files(hermesPath + "hermes-debug.aar")
197
+      releaseImplementation files(hermesPath + "hermes-release.aar")
198
+    } else {
199
+      implementation jscFlavor
200
+    }
201
+}
202
+
203
+// Run this once to be able to run the application with BUCK
204
+// puts all compile dependencies into folder libs for BUCK to use
205
+task copyDownloadableDepsToLibs(type: Copy) {
206
+    from configurations.compile
207
+    into 'libs'
208
+}
209
+
210
+apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)

+ 19
- 0
example/android/app/build_defs.bzl View File

@@ -0,0 +1,19 @@
1
+"""Helper definitions to glob .aar and .jar targets"""
2
+
3
+def create_aar_targets(aarfiles):
4
+    for aarfile in aarfiles:
5
+        name = "aars__" + aarfile[aarfile.rindex("/") + 1:aarfile.rindex(".aar")]
6
+        lib_deps.append(":" + name)
7
+        android_prebuilt_aar(
8
+            name = name,
9
+            aar = aarfile,
10
+        )
11
+
12
+def create_jar_targets(jarfiles):
13
+    for jarfile in jarfiles:
14
+        name = "jars__" + jarfile[jarfile.rindex("/") + 1:jarfile.rindex(".jar")]
15
+        lib_deps.append(":" + name)
16
+        prebuilt_jar(
17
+            name = name,
18
+            binary_jar = jarfile,
19
+        )

+ 10
- 0
example/android/app/proguard-rules.pro View File

@@ -0,0 +1,10 @@
1
+# Add project specific ProGuard rules here.
2
+# By default, the flags in this file are appended to flags specified
3
+# in /usr/local/Cellar/android-sdk/24.3.3/tools/proguard/proguard-android.txt
4
+# You can edit the include path and order by changing the proguardFiles
5
+# directive in build.gradle.
6
+#
7
+# For more details, see
8
+#   http://developer.android.com/guide/developing/tools/proguard.html
9
+
10
+# Add any project specific keep options here:

+ 8
- 0
example/android/app/src/debug/AndroidManifest.xml View File

@@ -0,0 +1,8 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3
+    xmlns:tools="http://schemas.android.com/tools">
4
+
5
+    <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
6
+
7
+    <application android:usesCleartextTraffic="true" tools:targetApi="28" tools:ignore="GoogleAppIndexingWarning" />
8
+</manifest>

+ 26
- 0
example/android/app/src/main/AndroidManifest.xml View File

@@ -0,0 +1,26 @@
1
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2
+  package="com.safeareaviewexample">
3
+
4
+    <uses-permission android:name="android.permission.INTERNET" />
5
+
6
+    <application
7
+      android:name=".MainApplication"
8
+      android:label="@string/app_name"
9
+      android:icon="@mipmap/ic_launcher"
10
+      android:roundIcon="@mipmap/ic_launcher_round"
11
+      android:allowBackup="false"
12
+      android:theme="@style/AppTheme">
13
+      <activity
14
+        android:name=".MainActivity"
15
+        android:label="@string/app_name"
16
+        android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
17
+        android:windowSoftInputMode="adjustResize">
18
+        <intent-filter>
19
+            <action android:name="android.intent.action.MAIN" />
20
+            <category android:name="android.intent.category.LAUNCHER" />
21
+        </intent-filter>
22
+      </activity>
23
+      <activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
24
+    </application>
25
+
26
+</manifest>

+ 15
- 0
example/android/app/src/main/java/com/safeareaviewexample/MainActivity.java View File

@@ -0,0 +1,15 @@
1
+package com.safeareaviewexample;
2
+
3
+import com.facebook.react.ReactActivity;
4
+
5
+public class MainActivity extends ReactActivity {
6
+
7
+    /**
8
+     * Returns the name of the main component registered from JavaScript.
9
+     * This is used to schedule rendering of the component.
10
+     */
11
+    @Override
12
+    protected String getMainComponentName() {
13
+        return "SafeAreaViewExample";
14
+    }
15
+}

+ 49
- 0
example/android/app/src/main/java/com/safeareaviewexample/MainApplication.java View File

@@ -0,0 +1,49 @@
1
+package com.safeareaviewexample;
2
+
3
+import android.app.Application;
4
+import android.util.Log;
5
+
6
+import com.facebook.react.PackageList;
7
+import com.facebook.hermes.reactexecutor.HermesExecutorFactory;
8
+import com.facebook.react.bridge.JavaScriptExecutorFactory;
9
+import com.facebook.react.ReactApplication;
10
+import com.facebook.react.ReactNativeHost;
11
+import com.facebook.react.ReactPackage;
12
+import com.facebook.soloader.SoLoader;
13
+
14
+import java.util.List;
15
+
16
+public class MainApplication extends Application implements ReactApplication {
17
+
18
+  private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
19
+    @Override
20
+    public boolean getUseDeveloperSupport() {
21
+      return BuildConfig.DEBUG;
22
+    }
23
+
24
+    @Override
25
+    protected List<ReactPackage> getPackages() {
26
+      @SuppressWarnings("UnnecessaryLocalVariable")
27
+      List<ReactPackage> packages = new PackageList(this).getPackages();
28
+      // Packages that cannot be autolinked yet can be added manually here, for example:
29
+      // packages.add(new MyReactNativePackage());
30
+      return packages;
31
+    }
32
+
33
+    @Override
34
+    protected String getJSMainModuleName() {
35
+      return "index";
36
+    }
37
+  };
38
+
39
+  @Override
40
+  public ReactNativeHost getReactNativeHost() {
41
+    return mReactNativeHost;
42
+  }
43
+
44
+  @Override
45
+  public void onCreate() {
46
+    super.onCreate();
47
+    SoLoader.init(this, /* native exopackage */ false);
48
+  }
49
+}

BIN
example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png View File


BIN
example/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png View File


BIN
example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png View File


BIN
example/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png View File


BIN
example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png View File


BIN
example/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png View File


BIN
example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png View File


BIN
example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png View File


BIN
example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png View File


BIN
example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png View File


+ 3
- 0
example/android/app/src/main/res/values/strings.xml View File

@@ -0,0 +1,3 @@
1
+<resources>
2
+    <string name="app_name">Hello App Display Name</string>
3
+</resources>

+ 9
- 0
example/android/app/src/main/res/values/styles.xml View File

@@ -0,0 +1,9 @@
1
+<resources>
2
+
3
+    <!-- Base application theme. -->
4
+    <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
5
+        <!-- Customize your theme here. -->
6
+        <item name="android:textColor">#000000</item>
7
+    </style>
8
+
9
+</resources>

+ 38
- 0
example/android/build.gradle View File

@@ -0,0 +1,38 @@
1
+// Top-level build file where you can add configuration options common to all sub-projects/modules.
2
+
3
+buildscript {
4
+    ext {
5
+        buildToolsVersion = "28.0.3"
6
+        minSdkVersion = 16
7
+        compileSdkVersion = 28
8
+        targetSdkVersion = 28
9
+        supportLibVersion = "28.0.0"
10
+    }
11
+    repositories {
12
+        google()
13
+        jcenter()
14
+    }
15
+    dependencies {
16
+        classpath("com.android.tools.build:gradle:3.4.1")
17
+
18
+        // NOTE: Do not place your application dependencies here; they belong
19
+        // in the individual module build.gradle files
20
+    }
21
+}
22
+
23
+allprojects {
24
+    repositories {
25
+        mavenLocal()
26
+        maven {
27
+            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
28
+            url("$rootDir/../node_modules/react-native/android")
29
+        }
30
+        maven {
31
+            // Android JSC is installed from npm
32
+            url("$rootDir/../node_modules/jsc-android/dist")
33
+        }
34
+
35
+        google()
36
+        jcenter()
37
+    }
38
+}

+ 21
- 0
example/android/gradle.properties View File

@@ -0,0 +1,21 @@
1
+# Project-wide Gradle settings.
2
+
3
+# IDE (e.g. Android Studio) users:
4
+# Gradle settings configured through the IDE *will override*
5
+# any settings specified in this file.
6
+
7
+# For more details on how to configure your build environment visit
8
+# http://www.gradle.org/docs/current/userguide/build_environment.html
9
+
10
+# Specifies the JVM arguments used for the daemon process.
11
+# The setting is particularly useful for tweaking memory settings.
12
+# Default value: -Xmx10248m -XX:MaxPermSize=256m
13
+# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
14
+
15
+# When configured, Gradle will run in incubating parallel mode.
16
+# This option should only be used with decoupled projects. More details, visit
17
+# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
18
+# org.gradle.parallel=true
19
+
20
+android.useAndroidX=true
21
+android.enableJetifier=true

BIN
example/android/gradle/wrapper/gradle-wrapper.jar View File


+ 5
- 0
example/android/gradle/wrapper/gradle-wrapper.properties View File

@@ -0,0 +1,5 @@
1
+distributionBase=GRADLE_USER_HOME
2
+distributionPath=wrapper/dists
3
+distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
4
+zipStoreBase=GRADLE_USER_HOME
5
+zipStorePath=wrapper/dists

+ 188
- 0
example/android/gradlew View File

@@ -0,0 +1,188 @@
1
+#!/usr/bin/env sh
2
+
3
+#
4
+# Copyright 2015 the original author or authors.
5
+#
6
+# Licensed under the Apache License, Version 2.0 (the "License");
7
+# you may not use this file except in compliance with the License.
8
+# You may obtain a copy of the License at
9
+#
10
+#      http://www.apache.org/licenses/LICENSE-2.0
11
+#
12
+# Unless required by applicable law or agreed to in writing, software
13
+# distributed under the License is distributed on an "AS IS" BASIS,
14
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+# See the License for the specific language governing permissions and
16
+# limitations under the License.
17
+#
18
+
19
+##############################################################################
20
+##
21
+##  Gradle start up script for UN*X
22
+##
23
+##############################################################################
24
+
25
+# Attempt to set APP_HOME
26
+# Resolve links: $0 may be a link
27
+PRG="$0"
28
+# Need this for relative symlinks.
29
+while [ -h "$PRG" ] ; do
30
+    ls=`ls -ld "$PRG"`
31
+    link=`expr "$ls" : '.*-> \(.*\)$'`
32
+    if expr "$link" : '/.*' > /dev/null; then
33
+        PRG="$link"
34
+    else
35
+        PRG=`dirname "$PRG"`"/$link"
36
+    fi
37
+done
38
+SAVED="`pwd`"
39
+cd "`dirname \"$PRG\"`/" >/dev/null
40
+APP_HOME="`pwd -P`"
41
+cd "$SAVED" >/dev/null
42
+
43
+APP_NAME="Gradle"
44
+APP_BASE_NAME=`basename "$0"`
45
+
46
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
47
+DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
48
+
49
+# Use the maximum available, or set MAX_FD != -1 to use that value.
50
+MAX_FD="maximum"
51
+
52
+warn () {
53
+    echo "$*"
54
+}
55
+
56
+die () {
57
+    echo
58
+    echo "$*"
59
+    echo
60
+    exit 1
61
+}
62
+
63
+# OS specific support (must be 'true' or 'false').
64
+cygwin=false
65
+msys=false
66
+darwin=false
67
+nonstop=false
68
+case "`uname`" in
69
+  CYGWIN* )
70
+    cygwin=true
71
+    ;;
72
+  Darwin* )
73
+    darwin=true
74
+    ;;
75
+  MINGW* )
76
+    msys=true
77
+    ;;
78
+  NONSTOP* )
79
+    nonstop=true
80
+    ;;
81
+esac
82
+
83
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
84
+
85
+# Determine the Java command to use to start the JVM.
86
+if [ -n "$JAVA_HOME" ] ; then
87
+    if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
88
+        # IBM's JDK on AIX uses strange locations for the executables
89
+        JAVACMD="$JAVA_HOME/jre/sh/java"
90
+    else
91
+        JAVACMD="$JAVA_HOME/bin/java"
92
+    fi
93
+    if [ ! -x "$JAVACMD" ] ; then
94
+        die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
95
+
96
+Please set the JAVA_HOME variable in your environment to match the
97
+location of your Java installation."
98
+    fi
99
+else
100
+    JAVACMD="java"
101
+    which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
102
+
103
+Please set the JAVA_HOME variable in your environment to match the
104
+location of your Java installation."
105
+fi
106
+
107
+# Increase the maximum file descriptors if we can.
108
+if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
109
+    MAX_FD_LIMIT=`ulimit -H -n`
110
+    if [ $? -eq 0 ] ; then
111
+        if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
112
+            MAX_FD="$MAX_FD_LIMIT"
113
+        fi
114
+        ulimit -n $MAX_FD
115
+        if [ $? -ne 0 ] ; then
116
+            warn "Could not set maximum file descriptor limit: $MAX_FD"
117
+        fi
118
+    else
119
+        warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
120
+    fi
121
+fi
122
+
123
+# For Darwin, add options to specify how the application appears in the dock
124
+if $darwin; then
125
+    GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
126
+fi
127
+
128
+# For Cygwin, switch paths to Windows format before running java
129
+if $cygwin ; then
130
+    APP_HOME=`cygpath --path --mixed "$APP_HOME"`
131
+    CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
132
+    JAVACMD=`cygpath --unix "$JAVACMD"`
133
+
134
+    # We build the pattern for arguments to be converted via cygpath
135
+    ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
136
+    SEP=""
137
+    for dir in $ROOTDIRSRAW ; do
138
+        ROOTDIRS="$ROOTDIRS$SEP$dir"
139
+        SEP="|"
140
+    done
141
+    OURCYGPATTERN="(^($ROOTDIRS))"
142
+    # Add a user-defined pattern to the cygpath arguments
143
+    if [ "$GRADLE_CYGPATTERN" != "" ] ; then
144
+        OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
145
+    fi
146
+    # Now convert the arguments - kludge to limit ourselves to /bin/sh
147
+    i=0
148
+    for arg in "$@" ; do
149
+        CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
150
+        CHECK2=`echo "$arg"|egrep -c "^-"`                                 ### Determine if an option
151
+
152
+        if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then                    ### Added a condition
153
+            eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
154
+        else
155
+            eval `echo args$i`="\"$arg\""
156
+        fi
157
+        i=$((i+1))
158
+    done
159
+    case $i in
160
+        (0) set -- ;;
161
+        (1) set -- "$args0" ;;
162
+        (2) set -- "$args0" "$args1" ;;
163
+        (3) set -- "$args0" "$args1" "$args2" ;;
164
+        (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
165
+        (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
166
+        (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
167
+        (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
168
+        (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
169
+        (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
170
+    esac
171
+fi
172
+
173
+# Escape application args
174
+save () {
175
+    for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
176
+    echo " "
177
+}
178
+APP_ARGS=$(save "$@")
179
+
180
+# Collect all arguments for the java command, following the shell quoting and substitution rules
181
+eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
182
+
183
+# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
184
+if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
185
+  cd "$(dirname "$0")"
186
+fi
187
+
188
+exec "$JAVACMD" "$@"

+ 100
- 0
example/android/gradlew.bat View File

@@ -0,0 +1,100 @@
1
+@rem
2
+@rem Copyright 2015 the original author or authors.
3
+@rem
4
+@rem Licensed under the Apache License, Version 2.0 (the "License");
5
+@rem you may not use this file except in compliance with the License.
6
+@rem You may obtain a copy of the License at
7
+@rem
8
+@rem      http://www.apache.org/licenses/LICENSE-2.0
9
+@rem
10
+@rem Unless required by applicable law or agreed to in writing, software
11
+@rem distributed under the License is distributed on an "AS IS" BASIS,
12
+@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+@rem See the License for the specific language governing permissions and
14
+@rem limitations under the License.
15
+@rem
16
+
17
+@if "%DEBUG%" == "" @echo off
18
+@rem ##########################################################################
19
+@rem
20
+@rem  Gradle startup script for Windows
21
+@rem
22
+@rem ##########################################################################
23
+
24
+@rem Set local scope for the variables with windows NT shell
25
+if "%OS%"=="Windows_NT" setlocal
26
+
27
+set DIRNAME=%~dp0
28
+if "%DIRNAME%" == "" set DIRNAME=.
29
+set APP_BASE_NAME=%~n0
30
+set APP_HOME=%DIRNAME%
31
+
32
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
33
+set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
34
+
35
+@rem Find java.exe
36
+if defined JAVA_HOME goto findJavaFromJavaHome
37
+
38
+set JAVA_EXE=java.exe
39
+%JAVA_EXE% -version >NUL 2>&1
40
+if "%ERRORLEVEL%" == "0" goto init
41
+
42
+echo.
43
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
44
+echo.
45
+echo Please set the JAVA_HOME variable in your environment to match the
46
+echo location of your Java installation.
47
+
48
+goto fail
49
+
50
+:findJavaFromJavaHome
51
+set JAVA_HOME=%JAVA_HOME:"=%
52
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
53
+
54
+if exist "%JAVA_EXE%" goto init
55
+
56
+echo.
57
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
58
+echo.
59
+echo Please set the JAVA_HOME variable in your environment to match the
60
+echo location of your Java installation.
61
+
62
+goto fail
63
+
64
+:init
65
+@rem Get command-line arguments, handling Windows variants
66
+
67
+if not "%OS%" == "Windows_NT" goto win9xME_args
68
+
69
+:win9xME_args
70
+@rem Slurp the command line arguments.
71
+set CMD_LINE_ARGS=
72
+set _SKIP=2
73
+
74
+:win9xME_args_slurp
75
+if "x%~1" == "x" goto execute
76
+
77
+set CMD_LINE_ARGS=%*
78
+
79
+:execute
80
+@rem Setup the command line
81
+
82
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
83
+
84
+@rem Execute Gradle
85
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
86
+
87
+:end
88
+@rem End local scope for the variables with windows NT shell
89
+if "%ERRORLEVEL%"=="0" goto mainEnd
90
+
91
+:fail
92
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
93
+rem the _cmd.exe /c_ return code!
94
+if  not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
95
+exit /b 1
96
+
97
+:mainEnd
98
+if "%OS%"=="Windows_NT" endlocal
99
+
100
+:omega

+ 3
- 0
example/android/settings.gradle View File

@@ -0,0 +1,3 @@
1
+rootProject.name = 'SafeAreaViewExample'
2
+apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)
3
+include ':app'

+ 4
- 0
example/app.json View File

@@ -0,0 +1,4 @@
1
+{
2
+  "name": "SafeAreaViewExample",
3
+  "displayName": "SafeAreaViewExample"
4
+}

+ 9
- 0
example/index.js View File

@@ -0,0 +1,9 @@
1
+/**
2
+ * @format
3
+ */
4
+
5
+import {AppRegistry} from 'react-native';
6
+import App from './App';
7
+import {name as appName} from './app.json';
8
+
9
+AppRegistry.registerComponent(appName, () => App);

+ 30
- 0
example/ios/Podfile View File

@@ -0,0 +1,30 @@
1
+platform :ios, '9.0'
2
+
3
+target 'SafeAreaViewExample' do
4
+  # Pods for SafeAreaViewExample
5
+  pod 'React', :path => '../../node_modules/react-native/'
6
+  pod 'React-Core', :path => '../../node_modules/react-native/React'
7
+  pod 'React-DevSupport', :path => '../../node_modules/react-native/React'
8
+  pod 'React-RCTActionSheet', :path => '../../node_modules/react-native/Libraries/ActionSheetIOS'
9
+  pod 'React-RCTAnimation', :path => '../../node_modules/react-native/Libraries/NativeAnimation'
10
+  pod 'React-RCTBlob', :path => '../../node_modules/react-native/Libraries/Blob'
11
+  pod 'React-RCTImage', :path => '../../node_modules/react-native/Libraries/Image'
12
+  pod 'React-RCTLinking', :path => '../../node_modules/react-native/Libraries/LinkingIOS'
13
+  pod 'React-RCTNetwork', :path => '../../node_modules/react-native/Libraries/Network'
14
+  pod 'React-RCTSettings', :path => '../../node_modules/react-native/Libraries/Settings'
15
+  pod 'React-RCTText', :path => '../../node_modules/react-native/Libraries/Text'
16
+  pod 'React-RCTVibration', :path => '../../node_modules/react-native/Libraries/Vibration'
17
+  pod 'React-RCTWebSocket', :path => '../../node_modules/react-native/Libraries/WebSocket'
18
+
19
+  pod 'React-cxxreact', :path => '../../node_modules/react-native/ReactCommon/cxxreact'
20
+  pod 'React-jsi', :path => '../../node_modules/react-native/ReactCommon/jsi'
21
+  pod 'React-jsiexecutor', :path => '../../node_modules/react-native/ReactCommon/jsiexecutor'
22
+  pod 'React-jsinspector', :path => '../../node_modules/react-native/ReactCommon/jsinspector'
23
+  pod 'yoga', :path => '../../node_modules/react-native/ReactCommon/yoga'
24
+
25
+  pod 'DoubleConversion', :podspec => '../../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'
26
+  pod 'glog', :podspec => '../../node_modules/react-native/third-party-podspecs/glog.podspec'
27
+  pod 'Folly', :podspec => '../../node_modules/react-native/third-party-podspecs/Folly.podspec'
28
+
29
+  pod 'th3rdwave-safe-area-view', :path => '../../'
30
+end

+ 187
- 0
example/ios/Podfile.lock View File

@@ -0,0 +1,187 @@
1
+PODS:
2
+  - boost-for-react-native (1.63.0)
3
+  - DoubleConversion (1.1.6)
4
+  - Folly (2018.10.22.00):
5
+    - boost-for-react-native
6
+    - DoubleConversion
7
+    - Folly/Default (= 2018.10.22.00)
8
+    - glog
9
+  - Folly/Default (2018.10.22.00):
10
+    - boost-for-react-native
11
+    - DoubleConversion
12
+    - glog
13
+  - glog (0.3.5)
14
+  - React (0.60.5):
15
+    - React-Core (= 0.60.5)
16
+    - React-DevSupport (= 0.60.5)
17
+    - React-RCTActionSheet (= 0.60.5)
18
+    - React-RCTAnimation (= 0.60.5)
19
+    - React-RCTBlob (= 0.60.5)
20
+    - React-RCTImage (= 0.60.5)
21
+    - React-RCTLinking (= 0.60.5)
22
+    - React-RCTNetwork (= 0.60.5)
23
+    - React-RCTSettings (= 0.60.5)
24
+    - React-RCTText (= 0.60.5)
25
+    - React-RCTVibration (= 0.60.5)
26
+    - React-RCTWebSocket (= 0.60.5)
27
+  - React-Core (0.60.5):
28
+    - Folly (= 2018.10.22.00)
29
+    - React-cxxreact (= 0.60.5)
30
+    - React-jsiexecutor (= 0.60.5)
31
+    - yoga (= 0.60.5.React)
32
+  - React-cxxreact (0.60.5):
33
+    - boost-for-react-native (= 1.63.0)
34
+    - DoubleConversion
35
+    - Folly (= 2018.10.22.00)
36
+    - glog
37
+    - React-jsinspector (= 0.60.5)
38
+  - React-DevSupport (0.60.5):
39
+    - React-Core (= 0.60.5)
40
+    - React-RCTWebSocket (= 0.60.5)
41
+  - React-jsi (0.60.5):
42
+    - boost-for-react-native (= 1.63.0)
43
+    - DoubleConversion
44
+    - Folly (= 2018.10.22.00)
45
+    - glog
46
+    - React-jsi/Default (= 0.60.5)
47
+  - React-jsi/Default (0.60.5):
48
+    - boost-for-react-native (= 1.63.0)
49
+    - DoubleConversion
50
+    - Folly (= 2018.10.22.00)
51
+    - glog
52
+  - React-jsiexecutor (0.60.5):
53
+    - DoubleConversion
54
+    - Folly (= 2018.10.22.00)
55
+    - glog
56
+    - React-cxxreact (= 0.60.5)
57
+    - React-jsi (= 0.60.5)
58
+  - React-jsinspector (0.60.5)
59
+  - React-RCTActionSheet (0.60.5):
60
+    - React-Core (= 0.60.5)
61
+  - React-RCTAnimation (0.60.5):
62
+    - React-Core (= 0.60.5)
63
+  - React-RCTBlob (0.60.5):
64
+    - React-Core (= 0.60.5)
65
+    - React-RCTNetwork (= 0.60.5)
66
+    - React-RCTWebSocket (= 0.60.5)
67
+  - React-RCTImage (0.60.5):
68
+    - React-Core (= 0.60.5)
69
+    - React-RCTNetwork (= 0.60.5)
70
+  - React-RCTLinking (0.60.5):
71
+    - React-Core (= 0.60.5)
72
+  - React-RCTNetwork (0.60.5):
73
+    - React-Core (= 0.60.5)
74
+  - React-RCTSettings (0.60.5):
75
+    - React-Core (= 0.60.5)
76
+  - React-RCTText (0.60.5):
77
+    - React-Core (= 0.60.5)
78
+  - React-RCTVibration (0.60.5):
79
+    - React-Core (= 0.60.5)
80
+  - React-RCTWebSocket (0.60.5):
81
+    - React-Core (= 0.60.5)
82
+  - th3rdwave-safe-area-view (0.1.0):
83
+    - React
84
+  - yoga (0.60.5.React)
85
+
86
+DEPENDENCIES:
87
+  - DoubleConversion (from `../../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec`)
88
+  - Folly (from `../../node_modules/react-native/third-party-podspecs/Folly.podspec`)
89
+  - glog (from `../../node_modules/react-native/third-party-podspecs/glog.podspec`)
90
+  - React (from `../../node_modules/react-native/`)
91
+  - React-Core (from `../../node_modules/react-native/React`)
92
+  - React-cxxreact (from `../../node_modules/react-native/ReactCommon/cxxreact`)
93
+  - React-DevSupport (from `../../node_modules/react-native/React`)
94
+  - React-jsi (from `../../node_modules/react-native/ReactCommon/jsi`)
95
+  - React-jsiexecutor (from `../../node_modules/react-native/ReactCommon/jsiexecutor`)
96
+  - React-jsinspector (from `../../node_modules/react-native/ReactCommon/jsinspector`)
97
+  - React-RCTActionSheet (from `../../node_modules/react-native/Libraries/ActionSheetIOS`)
98
+  - React-RCTAnimation (from `../../node_modules/react-native/Libraries/NativeAnimation`)
99
+  - React-RCTBlob (from `../../node_modules/react-native/Libraries/Blob`)
100
+  - React-RCTImage (from `../../node_modules/react-native/Libraries/Image`)
101
+  - React-RCTLinking (from `../../node_modules/react-native/Libraries/LinkingIOS`)
102
+  - React-RCTNetwork (from `../../node_modules/react-native/Libraries/Network`)
103
+  - React-RCTSettings (from `../../node_modules/react-native/Libraries/Settings`)
104
+  - React-RCTText (from `../../node_modules/react-native/Libraries/Text`)
105
+  - React-RCTVibration (from `../../node_modules/react-native/Libraries/Vibration`)
106
+  - React-RCTWebSocket (from `../../node_modules/react-native/Libraries/WebSocket`)
107
+  - th3rdwave-safe-area-view (from `../../`)
108
+  - yoga (from `../../node_modules/react-native/ReactCommon/yoga`)
109
+
110
+SPEC REPOS:
111
+  https://github.com/cocoapods/specs.git:
112
+    - boost-for-react-native
113
+
114
+EXTERNAL SOURCES:
115
+  DoubleConversion:
116
+    :podspec: "../../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec"
117
+  Folly:
118
+    :podspec: "../../node_modules/react-native/third-party-podspecs/Folly.podspec"
119
+  glog:
120
+    :podspec: "../../node_modules/react-native/third-party-podspecs/glog.podspec"
121
+  React:
122
+    :path: "../../node_modules/react-native/"
123
+  React-Core:
124
+    :path: "../../node_modules/react-native/React"
125
+  React-cxxreact:
126
+    :path: "../../node_modules/react-native/ReactCommon/cxxreact"
127
+  React-DevSupport:
128
+    :path: "../../node_modules/react-native/React"
129
+  React-jsi:
130
+    :path: "../../node_modules/react-native/ReactCommon/jsi"
131
+  React-jsiexecutor:
132
+    :path: "../../node_modules/react-native/ReactCommon/jsiexecutor"
133
+  React-jsinspector:
134
+    :path: "../../node_modules/react-native/ReactCommon/jsinspector"
135
+  React-RCTActionSheet:
136
+    :path: "../../node_modules/react-native/Libraries/ActionSheetIOS"
137
+  React-RCTAnimation:
138
+    :path: "../../node_modules/react-native/Libraries/NativeAnimation"
139
+  React-RCTBlob:
140
+    :path: "../../node_modules/react-native/Libraries/Blob"
141
+  React-RCTImage:
142
+    :path: "../../node_modules/react-native/Libraries/Image"
143
+  React-RCTLinking:
144
+    :path: "../../node_modules/react-native/Libraries/LinkingIOS"
145
+  React-RCTNetwork:
146
+    :path: "../../node_modules/react-native/Libraries/Network"
147
+  React-RCTSettings:
148
+    :path: "../../node_modules/react-native/Libraries/Settings"
149
+  React-RCTText:
150
+    :path: "../../node_modules/react-native/Libraries/Text"
151
+  React-RCTVibration:
152
+    :path: "../../node_modules/react-native/Libraries/Vibration"
153
+  React-RCTWebSocket:
154
+    :path: "../../node_modules/react-native/Libraries/WebSocket"
155
+  th3rdwave-safe-area-view:
156
+    :path: "../../"
157
+  yoga:
158
+    :path: "../../node_modules/react-native/ReactCommon/yoga"
159
+
160
+SPEC CHECKSUMS:
161
+  boost-for-react-native: 39c7adb57c4e60d6c5479dd8623128eb5b3f0f2c
162
+  DoubleConversion: 5805e889d232975c086db112ece9ed034df7a0b2
163
+  Folly: 30e7936e1c45c08d884aa59369ed951a8e68cf51
164
+  glog: 1f3da668190260b06b429bb211bfbee5cd790c28
165
+  React: 53c53c4d99097af47cf60594b8706b4e3321e722
166
+  React-Core: ba421f6b4f4cbe2fb17c0b6fc675f87622e78a64
167
+  React-cxxreact: 8384287780c4999351ad9b6e7a149d9ed10a2395
168
+  React-DevSupport: 197fb409737cff2c4f9986e77c220d7452cb9f9f
169
+  React-jsi: 4d8c9efb6312a9725b18d6fc818ffc103f60fec2
170
+  React-jsiexecutor: 90ad2f9db09513fc763bc757fdc3c4ff8bde2a30
171
+  React-jsinspector: e08662d1bf5b129a3d556eb9ea343a3f40353ae4
172
+  React-RCTActionSheet: b0f1ea83f4bf75fb966eae9bfc47b78c8d3efd90
173
+  React-RCTAnimation: 359ba1b5690b1e87cc173558a78e82d35919333e
174
+  React-RCTBlob: 5e2b55f76e9a1c7ae52b826923502ddc3238df24
175
+  React-RCTImage: f5f1c50922164e89bdda67bcd0153952a5cfe719
176
+  React-RCTLinking: d0ecbd791e9ddddc41fa1f66b0255de90e8ee1e9
177
+  React-RCTNetwork: e26946300b0ab7bb6c4a6348090e93fa21f33a9d
178
+  React-RCTSettings: d0d37cb521b7470c998595a44f05847777cc3f42
179
+  React-RCTText: b074d89033583d4f2eb5faf7ea2db3a13c7553a2
180
+  React-RCTVibration: 2105b2e0e2b66a6408fc69a46c8a7fb5b2fdade0
181
+  React-RCTWebSocket: cd932a16b7214898b6b7f788c8bddb3637246ac4
182
+  th3rdwave-safe-area-view: bce8cc315b0c93628ccbf4746cae562d04395e70
183
+  yoga: 312528f5bbbba37b4dcea5ef00e8b4033fdd9411
184
+
185
+PODFILE CHECKSUM: 175c785535da0f80766a91718b506091f0821b36
186
+
187
+COCOAPODS: 1.7.5

+ 53
- 0
example/ios/SafeAreaViewExample-tvOS/Info.plist View File

@@ -0,0 +1,53 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+<plist version="1.0">
4
+<dict>
5
+	<key>CFBundleDevelopmentRegion</key>
6
+	<string>en</string>
7
+	<key>CFBundleExecutable</key>
8
+	<string>$(EXECUTABLE_NAME)</string>
9
+	<key>CFBundleIdentifier</key>
10
+	<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
11
+	<key>CFBundleInfoDictionaryVersion</key>
12
+	<string>6.0</string>
13
+	<key>CFBundleName</key>
14
+	<string>$(PRODUCT_NAME)</string>
15
+	<key>CFBundlePackageType</key>
16
+	<string>APPL</string>
17
+	<key>CFBundleShortVersionString</key>
18
+	<string>1.0</string>
19
+	<key>CFBundleSignature</key>
20
+	<string>????</string>
21
+	<key>CFBundleVersion</key>
22
+	<string>1</string>
23
+	<key>LSRequiresIPhoneOS</key>
24
+	<true/>
25
+	<key>NSAppTransportSecurity</key>
26
+	<dict>
27
+		<key>NSExceptionDomains</key>
28
+		<dict>
29
+			<key>localhost</key>
30
+			<dict>
31
+				<key>NSExceptionAllowsInsecureHTTPLoads</key>
32
+				<true/>
33
+			</dict>
34
+		</dict>
35
+	</dict>
36
+	<key>NSLocationWhenInUseUsageDescription</key>
37
+	<string></string>
38
+	<key>UILaunchStoryboardName</key>
39
+	<string>LaunchScreen</string>
40
+	<key>UIRequiredDeviceCapabilities</key>
41
+	<array>
42
+		<string>armv7</string>
43
+	</array>
44
+	<key>UISupportedInterfaceOrientations</key>
45
+	<array>
46
+		<string>UIInterfaceOrientationPortrait</string>
47
+		<string>UIInterfaceOrientationLandscapeLeft</string>
48
+		<string>UIInterfaceOrientationLandscapeRight</string>
49
+	</array>
50
+	<key>UIViewControllerBasedStatusBarAppearance</key>
51
+	<false/>
52
+</dict>
53
+</plist>

+ 24
- 0
example/ios/SafeAreaViewExample-tvOSTests/Info.plist View File

@@ -0,0 +1,24 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+<plist version="1.0">
4
+<dict>
5
+	<key>CFBundleDevelopmentRegion</key>
6
+	<string>en</string>
7
+	<key>CFBundleExecutable</key>
8
+	<string>$(EXECUTABLE_NAME)</string>
9
+	<key>CFBundleIdentifier</key>
10
+	<string>org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)</string>
11
+	<key>CFBundleInfoDictionaryVersion</key>
12
+	<string>6.0</string>
13
+	<key>CFBundleName</key>
14
+	<string>$(PRODUCT_NAME)</string>
15
+	<key>CFBundlePackageType</key>
16
+	<string>BNDL</string>
17
+	<key>CFBundleShortVersionString</key>
18
+	<string>1.0</string>
19
+	<key>CFBundleSignature</key>
20
+	<string>????</string>
21
+	<key>CFBundleVersion</key>
22
+	<string>1</string>
23
+</dict>
24
+</plist>

+ 416
- 0
example/ios/SafeAreaViewExample.xcodeproj/project.pbxproj View File

@@ -0,0 +1,416 @@
1
+// !$*UTF8*$!
2
+{
3
+	archiveVersion = 1;
4
+	classes = {
5
+	};
6
+	objectVersion = 46;
7
+	objects = {
8
+
9
+/* Begin PBXBuildFile section */
10
+		13B07FBC1A68108700A75B9A /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB01A68108700A75B9A /* AppDelegate.m */; };
11
+		13B07FBD1A68108700A75B9A /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB11A68108700A75B9A /* LaunchScreen.xib */; };
12
+		13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; };
13
+		13B07FC11A68108700A75B9A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; };
14
+		D590E4D001221F6B5AF11381 /* libPods-SafeAreaViewExample.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 275F94A75481D4E6C652CF4F /* libPods-SafeAreaViewExample.a */; };
15
+/* End PBXBuildFile section */
16
+
17
+/* Begin PBXFileReference section */
18
+		008F07F21AC5B25A0029DE68 /* main.jsbundle */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = main.jsbundle; sourceTree = "<group>"; };
19
+		0A89B68A414A9ACE6081995A /* Pods-SafeAreaViewExample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SafeAreaViewExample.debug.xcconfig"; path = "Target Support Files/Pods-SafeAreaViewExample/Pods-SafeAreaViewExample.debug.xcconfig"; sourceTree = "<group>"; };
20
+		13B07F961A680F5B00A75B9A /* SafeAreaViewExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SafeAreaViewExample.app; sourceTree = BUILT_PRODUCTS_DIR; };
21
+		13B07FAF1A68108700A75B9A /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AppDelegate.h; path = SafeAreaViewExample/AppDelegate.h; sourceTree = "<group>"; };
22
+		13B07FB01A68108700A75B9A /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AppDelegate.m; path = SafeAreaViewExample/AppDelegate.m; sourceTree = "<group>"; };
23
+		13B07FB21A68108700A75B9A /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = "<group>"; };
24
+		13B07FB51A68108700A75B9A /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = SafeAreaViewExample/Images.xcassets; sourceTree = "<group>"; };
25
+		13B07FB61A68108700A75B9A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = SafeAreaViewExample/Info.plist; sourceTree = "<group>"; };
26
+		13B07FB71A68108700A75B9A /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = SafeAreaViewExample/main.m; sourceTree = "<group>"; };
27
+		275F94A75481D4E6C652CF4F /* libPods-SafeAreaViewExample.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-SafeAreaViewExample.a"; sourceTree = BUILT_PRODUCTS_DIR; };
28
+		69AAEDE94ED39E6A720417AA /* Pods-SafeAreaViewExample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SafeAreaViewExample.release.xcconfig"; path = "Target Support Files/Pods-SafeAreaViewExample/Pods-SafeAreaViewExample.release.xcconfig"; sourceTree = "<group>"; };
29
+		ED297162215061F000B7C4FE /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; };
30
+		ED2971642150620600B7C4FE /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS12.0.sdk/System/Library/Frameworks/JavaScriptCore.framework; sourceTree = DEVELOPER_DIR; };
31
+/* End PBXFileReference section */
32
+
33
+/* Begin PBXFrameworksBuildPhase section */
34
+		13B07F8C1A680F5B00A75B9A /* Frameworks */ = {
35
+			isa = PBXFrameworksBuildPhase;
36
+			buildActionMask = 2147483647;
37
+			files = (
38
+				D590E4D001221F6B5AF11381 /* libPods-SafeAreaViewExample.a in Frameworks */,
39
+			);
40
+			runOnlyForDeploymentPostprocessing = 0;
41
+		};
42
+/* End PBXFrameworksBuildPhase section */
43
+
44
+/* Begin PBXGroup section */
45
+		13B07FAE1A68108700A75B9A /* SafeAreaViewExample */ = {
46
+			isa = PBXGroup;
47
+			children = (
48
+				008F07F21AC5B25A0029DE68 /* main.jsbundle */,
49
+				13B07FAF1A68108700A75B9A /* AppDelegate.h */,
50
+				13B07FB01A68108700A75B9A /* AppDelegate.m */,
51
+				13B07FB51A68108700A75B9A /* Images.xcassets */,
52
+				13B07FB61A68108700A75B9A /* Info.plist */,
53
+				13B07FB11A68108700A75B9A /* LaunchScreen.xib */,
54
+				13B07FB71A68108700A75B9A /* main.m */,
55
+			);
56
+			name = SafeAreaViewExample;
57
+			sourceTree = "<group>";
58
+		};
59
+		2D16E6871FA4F8E400B85C8A /* Frameworks */ = {
60
+			isa = PBXGroup;
61
+			children = (
62
+				ED297162215061F000B7C4FE /* JavaScriptCore.framework */,
63
+				ED2971642150620600B7C4FE /* JavaScriptCore.framework */,
64
+				275F94A75481D4E6C652CF4F /* libPods-SafeAreaViewExample.a */,
65
+			);
66
+			name = Frameworks;
67
+			sourceTree = "<group>";
68
+		};
69
+		832341AE1AAA6A7D00B99B32 /* Libraries */ = {
70
+			isa = PBXGroup;
71
+			children = (
72
+			);
73
+			name = Libraries;
74
+			sourceTree = "<group>";
75
+		};
76
+		83CBB9F61A601CBA00E9B192 = {
77
+			isa = PBXGroup;
78
+			children = (
79
+				13B07FAE1A68108700A75B9A /* SafeAreaViewExample */,
80
+				832341AE1AAA6A7D00B99B32 /* Libraries */,
81
+				83CBBA001A601CBA00E9B192 /* Products */,
82
+				2D16E6871FA4F8E400B85C8A /* Frameworks */,
83
+				8420299E7589F138B56B721A /* Pods */,
84
+			);
85
+			indentWidth = 2;
86
+			sourceTree = "<group>";
87
+			tabWidth = 2;
88
+			usesTabs = 0;
89
+		};
90
+		83CBBA001A601CBA00E9B192 /* Products */ = {
91
+			isa = PBXGroup;
92
+			children = (
93
+				13B07F961A680F5B00A75B9A /* SafeAreaViewExample.app */,
94
+			);
95
+			name = Products;
96
+			sourceTree = "<group>";
97
+		};
98
+		8420299E7589F138B56B721A /* Pods */ = {
99
+			isa = PBXGroup;
100
+			children = (
101
+				0A89B68A414A9ACE6081995A /* Pods-SafeAreaViewExample.debug.xcconfig */,
102
+				69AAEDE94ED39E6A720417AA /* Pods-SafeAreaViewExample.release.xcconfig */,
103
+			);
104
+			path = Pods;
105
+			sourceTree = "<group>";
106
+		};
107
+/* End PBXGroup section */
108
+
109
+/* Begin PBXNativeTarget section */
110
+		13B07F861A680F5B00A75B9A /* SafeAreaViewExample */ = {
111
+			isa = PBXNativeTarget;
112
+			buildConfigurationList = 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "SafeAreaViewExample" */;
113
+			buildPhases = (
114
+				583C785316E508E312E6F376 /* [CP] Check Pods Manifest.lock */,
115
+				FD10A7F022414F080027D42C /* Start Packager */,
116
+				13B07F871A680F5B00A75B9A /* Sources */,
117
+				13B07F8C1A680F5B00A75B9A /* Frameworks */,
118
+				13B07F8E1A680F5B00A75B9A /* Resources */,
119
+				00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */,
120
+			);
121
+			buildRules = (
122
+			);
123
+			dependencies = (
124
+			);
125
+			name = SafeAreaViewExample;
126
+			productName = SafeAreaViewExample;
127
+			productReference = 13B07F961A680F5B00A75B9A /* SafeAreaViewExample.app */;
128
+			productType = "com.apple.product-type.application";
129
+		};
130
+/* End PBXNativeTarget section */
131
+
132
+/* Begin PBXProject section */
133
+		83CBB9F71A601CBA00E9B192 /* Project object */ = {
134
+			isa = PBXProject;
135
+			attributes = {
136
+				LastUpgradeCheck = 1030;
137
+				ORGANIZATIONNAME = Facebook;
138
+			};
139
+			buildConfigurationList = 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "SafeAreaViewExample" */;
140
+			compatibilityVersion = "Xcode 3.2";
141
+			developmentRegion = en;
142
+			hasScannedForEncodings = 0;
143
+			knownRegions = (
144
+				en,
145
+				Base,
146
+			);
147
+			mainGroup = 83CBB9F61A601CBA00E9B192;
148
+			productRefGroup = 83CBBA001A601CBA00E9B192 /* Products */;
149
+			projectDirPath = "";
150
+			projectRoot = "";
151
+			targets = (
152
+				13B07F861A680F5B00A75B9A /* SafeAreaViewExample */,
153
+			);
154
+		};
155
+/* End PBXProject section */
156
+
157
+/* Begin PBXResourcesBuildPhase section */
158
+		13B07F8E1A680F5B00A75B9A /* Resources */ = {
159
+			isa = PBXResourcesBuildPhase;
160
+			buildActionMask = 2147483647;
161
+			files = (
162
+				13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */,
163
+				13B07FBD1A68108700A75B9A /* LaunchScreen.xib in Resources */,
164
+			);
165
+			runOnlyForDeploymentPostprocessing = 0;
166
+		};
167
+/* End PBXResourcesBuildPhase section */
168
+
169
+/* Begin PBXShellScriptBuildPhase section */
170
+		00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */ = {
171
+			isa = PBXShellScriptBuildPhase;
172
+			buildActionMask = 2147483647;
173
+			files = (
174
+			);
175
+			inputPaths = (
176
+			);
177
+			name = "Bundle React Native code and images";
178
+			outputPaths = (
179
+			);
180
+			runOnlyForDeploymentPostprocessing = 0;
181
+			shellPath = /bin/sh;
182
+			shellScript = "export NODE_BINARY=node\n../../node_modules/react-native/scripts/react-native-xcode.sh\n";
183
+		};
184
+		583C785316E508E312E6F376 /* [CP] Check Pods Manifest.lock */ = {
185
+			isa = PBXShellScriptBuildPhase;
186
+			buildActionMask = 2147483647;
187
+			files = (
188
+			);
189
+			inputFileListPaths = (
190
+			);
191
+			inputPaths = (
192
+				"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
193
+				"${PODS_ROOT}/Manifest.lock",
194
+			);
195
+			name = "[CP] Check Pods Manifest.lock";
196
+			outputFileListPaths = (
197
+			);
198
+			outputPaths = (
199
+				"$(DERIVED_FILE_DIR)/Pods-SafeAreaViewExample-checkManifestLockResult.txt",
200
+			);
201
+			runOnlyForDeploymentPostprocessing = 0;
202
+			shellPath = /bin/sh;
203
+			shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n    # print error to STDERR\n    echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n    exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
204
+			showEnvVarsInLog = 0;
205
+		};
206
+		FD10A7F022414F080027D42C /* Start Packager */ = {
207
+			isa = PBXShellScriptBuildPhase;
208
+			buildActionMask = 2147483647;
209
+			files = (
210
+			);
211
+			inputFileListPaths = (
212
+			);
213
+			inputPaths = (
214
+			);
215
+			name = "Start Packager";
216
+			outputFileListPaths = (
217
+			);
218
+			outputPaths = (
219
+			);
220
+			runOnlyForDeploymentPostprocessing = 0;
221
+			shellPath = /bin/sh;
222
+			shellScript = "export RCT_METRO_PORT=\"${RCT_METRO_PORT:=8081}\"\necho \"export RCT_METRO_PORT=${RCT_METRO_PORT}\" > \"${SRCROOT}/../../node_modules/react-native/scripts/.packager.env\"\nif [ -z \"${RCT_NO_LAUNCH_PACKAGER+xxx}\" ] ; then\n  if nc -w 5 -z localhost ${RCT_METRO_PORT} ; then\n    if ! curl -s \"http://localhost:${RCT_METRO_PORT}/status\" | grep -q \"packager-status:running\" ; then\n      echo \"Port ${RCT_METRO_PORT} already in use, packager is either not running or not running correctly\"\n      exit 2\n    fi\n  else\n    open \"$SRCROOT/../node_modules/react-native/scripts/launchPackager.command\" || echo \"Can't start packager automatically\"\n  fi\nfi\n";
223
+			showEnvVarsInLog = 0;
224
+		};
225
+/* End PBXShellScriptBuildPhase section */
226
+
227
+/* Begin PBXSourcesBuildPhase section */
228
+		13B07F871A680F5B00A75B9A /* Sources */ = {
229
+			isa = PBXSourcesBuildPhase;
230
+			buildActionMask = 2147483647;
231
+			files = (
232
+				13B07FBC1A68108700A75B9A /* AppDelegate.m in Sources */,
233
+				13B07FC11A68108700A75B9A /* main.m in Sources */,
234
+			);
235
+			runOnlyForDeploymentPostprocessing = 0;
236
+		};
237
+/* End PBXSourcesBuildPhase section */
238
+
239
+/* Begin PBXVariantGroup section */
240
+		13B07FB11A68108700A75B9A /* LaunchScreen.xib */ = {
241
+			isa = PBXVariantGroup;
242
+			children = (
243
+				13B07FB21A68108700A75B9A /* Base */,
244
+			);
245
+			name = LaunchScreen.xib;
246
+			path = SafeAreaViewExample;
247
+			sourceTree = "<group>";
248
+		};
249
+/* End PBXVariantGroup section */
250
+
251
+/* Begin XCBuildConfiguration section */
252
+		13B07F941A680F5B00A75B9A /* Debug */ = {
253
+			isa = XCBuildConfiguration;
254
+			baseConfigurationReference = 0A89B68A414A9ACE6081995A /* Pods-SafeAreaViewExample.debug.xcconfig */;
255
+			buildSettings = {
256
+				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
257
+				CURRENT_PROJECT_VERSION = 1;
258
+				DEAD_CODE_STRIPPING = NO;
259
+				INFOPLIST_FILE = SafeAreaViewExample/Info.plist;
260
+				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
261
+				OTHER_LDFLAGS = (
262
+					"$(inherited)",
263
+					"-ObjC",
264
+					"-lc++",
265
+				);
266
+				PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)";
267
+				PRODUCT_NAME = SafeAreaViewExample;
268
+				VERSIONING_SYSTEM = "apple-generic";
269
+			};
270
+			name = Debug;
271
+		};
272
+		13B07F951A680F5B00A75B9A /* Release */ = {
273
+			isa = XCBuildConfiguration;
274
+			baseConfigurationReference = 69AAEDE94ED39E6A720417AA /* Pods-SafeAreaViewExample.release.xcconfig */;
275
+			buildSettings = {
276
+				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
277
+				CURRENT_PROJECT_VERSION = 1;
278
+				INFOPLIST_FILE = SafeAreaViewExample/Info.plist;
279
+				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
280
+				OTHER_LDFLAGS = (
281
+					"$(inherited)",
282
+					"-ObjC",
283
+					"-lc++",
284
+				);
285
+				PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)";
286
+				PRODUCT_NAME = SafeAreaViewExample;
287
+				VERSIONING_SYSTEM = "apple-generic";
288
+			};
289
+			name = Release;
290
+		};
291
+		83CBBA201A601CBA00E9B192 /* Debug */ = {
292
+			isa = XCBuildConfiguration;
293
+			buildSettings = {
294
+				ALWAYS_SEARCH_USER_PATHS = NO;
295
+				CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
296
+				CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
297
+				CLANG_CXX_LIBRARY = "libc++";
298
+				CLANG_ENABLE_MODULES = YES;
299
+				CLANG_ENABLE_OBJC_ARC = YES;
300
+				CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
301
+				CLANG_WARN_BOOL_CONVERSION = YES;
302
+				CLANG_WARN_COMMA = YES;
303
+				CLANG_WARN_CONSTANT_CONVERSION = YES;
304
+				CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
305
+				CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
306
+				CLANG_WARN_EMPTY_BODY = YES;
307
+				CLANG_WARN_ENUM_CONVERSION = YES;
308
+				CLANG_WARN_INFINITE_RECURSION = YES;
309
+				CLANG_WARN_INT_CONVERSION = YES;
310
+				CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
311
+				CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
312
+				CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
313
+				CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
314
+				CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
315
+				CLANG_WARN_STRICT_PROTOTYPES = YES;
316
+				CLANG_WARN_SUSPICIOUS_MOVE = YES;
317
+				CLANG_WARN_UNREACHABLE_CODE = YES;
318
+				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
319
+				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
320
+				COPY_PHASE_STRIP = NO;
321
+				ENABLE_STRICT_OBJC_MSGSEND = YES;
322
+				ENABLE_TESTABILITY = YES;
323
+				GCC_C_LANGUAGE_STANDARD = gnu99;
324
+				GCC_DYNAMIC_NO_PIC = NO;
325
+				GCC_NO_COMMON_BLOCKS = YES;
326
+				GCC_OPTIMIZATION_LEVEL = 0;
327
+				GCC_PREPROCESSOR_DEFINITIONS = (
328
+					"DEBUG=1",
329
+					"$(inherited)",
330
+				);
331
+				GCC_SYMBOLS_PRIVATE_EXTERN = NO;
332
+				GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
333
+				GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
334
+				GCC_WARN_UNDECLARED_SELECTOR = YES;
335
+				GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
336
+				GCC_WARN_UNUSED_FUNCTION = YES;
337
+				GCC_WARN_UNUSED_VARIABLE = YES;
338
+				IPHONEOS_DEPLOYMENT_TARGET = 9.0;
339
+				MTL_ENABLE_DEBUG_INFO = YES;
340
+				ONLY_ACTIVE_ARCH = YES;
341
+				SDKROOT = iphoneos;
342
+			};
343
+			name = Debug;
344
+		};
345
+		83CBBA211A601CBA00E9B192 /* Release */ = {
346
+			isa = XCBuildConfiguration;
347
+			buildSettings = {
348
+				ALWAYS_SEARCH_USER_PATHS = NO;
349
+				CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
350
+				CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
351
+				CLANG_CXX_LIBRARY = "libc++";
352
+				CLANG_ENABLE_MODULES = YES;
353
+				CLANG_ENABLE_OBJC_ARC = YES;
354
+				CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
355
+				CLANG_WARN_BOOL_CONVERSION = YES;
356
+				CLANG_WARN_COMMA = YES;
357
+				CLANG_WARN_CONSTANT_CONVERSION = YES;
358
+				CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
359
+				CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
360
+				CLANG_WARN_EMPTY_BODY = YES;
361
+				CLANG_WARN_ENUM_CONVERSION = YES;
362
+				CLANG_WARN_INFINITE_RECURSION = YES;
363
+				CLANG_WARN_INT_CONVERSION = YES;
364
+				CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
365
+				CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
366
+				CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
367
+				CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
368
+				CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
369
+				CLANG_WARN_STRICT_PROTOTYPES = YES;
370
+				CLANG_WARN_SUSPICIOUS_MOVE = YES;
371
+				CLANG_WARN_UNREACHABLE_CODE = YES;
372
+				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
373
+				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
374
+				COPY_PHASE_STRIP = YES;
375
+				ENABLE_NS_ASSERTIONS = NO;
376
+				ENABLE_STRICT_OBJC_MSGSEND = YES;
377
+				GCC_C_LANGUAGE_STANDARD = gnu99;
378
+				GCC_NO_COMMON_BLOCKS = YES;
379
+				GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
380
+				GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
381
+				GCC_WARN_UNDECLARED_SELECTOR = YES;
382
+				GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
383
+				GCC_WARN_UNUSED_FUNCTION = YES;
384
+				GCC_WARN_UNUSED_VARIABLE = YES;
385
+				IPHONEOS_DEPLOYMENT_TARGET = 9.0;
386
+				MTL_ENABLE_DEBUG_INFO = NO;
387
+				SDKROOT = iphoneos;
388
+				VALIDATE_PRODUCT = YES;
389
+			};
390
+			name = Release;
391
+		};
392
+/* End XCBuildConfiguration section */
393
+
394
+/* Begin XCConfigurationList section */
395
+		13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "SafeAreaViewExample" */ = {
396
+			isa = XCConfigurationList;
397
+			buildConfigurations = (
398
+				13B07F941A680F5B00A75B9A /* Debug */,
399
+				13B07F951A680F5B00A75B9A /* Release */,
400
+			);
401
+			defaultConfigurationIsVisible = 0;
402
+			defaultConfigurationName = Release;
403
+		};
404
+		83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "SafeAreaViewExample" */ = {
405
+			isa = XCConfigurationList;
406
+			buildConfigurations = (
407
+				83CBBA201A601CBA00E9B192 /* Debug */,
408
+				83CBBA211A601CBA00E9B192 /* Release */,
409
+			);
410
+			defaultConfigurationIsVisible = 0;
411
+			defaultConfigurationName = Release;
412
+		};
413
+/* End XCConfigurationList section */
414
+	};
415
+	rootObject = 83CBB9F71A601CBA00E9B192 /* Project object */;
416
+}

+ 129
- 0
example/ios/SafeAreaViewExample.xcodeproj/xcshareddata/xcschemes/SafeAreaViewExample.xcscheme View File

@@ -0,0 +1,129 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<Scheme
3
+   LastUpgradeVersion = "1030"
4
+   version = "1.3">
5
+   <BuildAction
6
+      parallelizeBuildables = "NO"
7
+      buildImplicitDependencies = "YES">
8
+      <BuildActionEntries>
9
+         <BuildActionEntry
10
+            buildForTesting = "YES"
11
+            buildForRunning = "YES"
12
+            buildForProfiling = "YES"
13
+            buildForArchiving = "YES"
14
+            buildForAnalyzing = "YES">
15
+            <BuildableReference
16
+               BuildableIdentifier = "primary"
17
+               BlueprintIdentifier = "83CBBA2D1A601D0E00E9B192"
18
+               BuildableName = "libReact.a"
19
+               BlueprintName = "React"
20
+               ReferencedContainer = "container:../node_modules/react-native/React/React.xcodeproj">
21
+            </BuildableReference>
22
+         </BuildActionEntry>
23
+         <BuildActionEntry
24
+            buildForTesting = "YES"
25
+            buildForRunning = "YES"
26
+            buildForProfiling = "YES"
27
+            buildForArchiving = "YES"
28
+            buildForAnalyzing = "YES">
29
+            <BuildableReference
30
+               BuildableIdentifier = "primary"
31
+               BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
32
+               BuildableName = "SafeAreaViewExample.app"
33
+               BlueprintName = "SafeAreaViewExample"
34
+               ReferencedContainer = "container:SafeAreaViewExample.xcodeproj">
35
+            </BuildableReference>
36
+         </BuildActionEntry>
37
+         <BuildActionEntry
38
+            buildForTesting = "YES"
39
+            buildForRunning = "YES"
40
+            buildForProfiling = "NO"
41
+            buildForArchiving = "NO"
42
+            buildForAnalyzing = "YES">
43
+            <BuildableReference
44
+               BuildableIdentifier = "primary"
45
+               BlueprintIdentifier = "00E356ED1AD99517003FC87E"
46
+               BuildableName = "SafeAreaViewExampleTests.xctest"
47
+               BlueprintName = "SafeAreaViewExampleTests"
48
+               ReferencedContainer = "container:SafeAreaViewExample.xcodeproj">
49
+            </BuildableReference>
50
+         </BuildActionEntry>
51
+      </BuildActionEntries>
52
+   </BuildAction>
53
+   <TestAction
54
+      buildConfiguration = "Debug"
55
+      selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
56
+      selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
57
+      shouldUseLaunchSchemeArgsEnv = "YES">
58
+      <Testables>
59
+         <TestableReference
60
+            skipped = "NO">
61
+            <BuildableReference
62
+               BuildableIdentifier = "primary"
63
+               BlueprintIdentifier = "00E356ED1AD99517003FC87E"
64
+               BuildableName = "SafeAreaViewExampleTests.xctest"
65
+               BlueprintName = "SafeAreaViewExampleTests"
66
+               ReferencedContainer = "container:SafeAreaViewExample.xcodeproj">
67
+            </BuildableReference>
68
+         </TestableReference>
69
+      </Testables>
70
+      <MacroExpansion>
71
+         <BuildableReference
72
+            BuildableIdentifier = "primary"
73
+            BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
74
+            BuildableName = "SafeAreaViewExample.app"
75
+            BlueprintName = "SafeAreaViewExample"
76
+            ReferencedContainer = "container:SafeAreaViewExample.xcodeproj">
77
+         </BuildableReference>
78
+      </MacroExpansion>
79
+      <AdditionalOptions>
80
+      </AdditionalOptions>
81
+   </TestAction>
82
+   <LaunchAction
83
+      buildConfiguration = "Debug"
84
+      selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
85
+      selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
86
+      launchStyle = "0"
87
+      useCustomWorkingDirectory = "NO"
88
+      ignoresPersistentStateOnLaunch = "NO"
89
+      debugDocumentVersioning = "YES"
90
+      debugServiceExtension = "internal"
91
+      allowLocationSimulation = "YES">
92
+      <BuildableProductRunnable
93
+         runnableDebuggingMode = "0">
94
+         <BuildableReference
95
+            BuildableIdentifier = "primary"
96
+            BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
97
+            BuildableName = "SafeAreaViewExample.app"
98
+            BlueprintName = "SafeAreaViewExample"
99
+            ReferencedContainer = "container:SafeAreaViewExample.xcodeproj">
100
+         </BuildableReference>
101
+      </BuildableProductRunnable>
102
+      <AdditionalOptions>
103
+      </AdditionalOptions>
104
+   </LaunchAction>
105
+   <ProfileAction
106
+      buildConfiguration = "Release"
107
+      shouldUseLaunchSchemeArgsEnv = "YES"
108
+      savedToolIdentifier = ""
109
+      useCustomWorkingDirectory = "NO"
110
+      debugDocumentVersioning = "YES">
111
+      <BuildableProductRunnable
112
+         runnableDebuggingMode = "0">
113
+         <BuildableReference
114
+            BuildableIdentifier = "primary"
115
+            BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
116
+            BuildableName = "SafeAreaViewExample.app"
117
+            BlueprintName = "SafeAreaViewExample"
118
+            ReferencedContainer = "container:SafeAreaViewExample.xcodeproj">
119
+         </BuildableReference>
120
+      </BuildableProductRunnable>
121
+   </ProfileAction>
122
+   <AnalyzeAction
123
+      buildConfiguration = "Debug">
124
+   </AnalyzeAction>
125
+   <ArchiveAction
126
+      buildConfiguration = "Release"
127
+      revealArchiveInOrganizer = "YES">
128
+   </ArchiveAction>
129
+</Scheme>

+ 10
- 0
example/ios/SafeAreaViewExample.xcworkspace/contents.xcworkspacedata View File

@@ -0,0 +1,10 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<Workspace
3
+   version = "1.0">
4
+   <FileRef
5
+      location = "group:SafeAreaViewExample.xcodeproj">
6
+   </FileRef>
7
+   <FileRef
8
+      location = "group:Pods/Pods.xcodeproj">
9
+   </FileRef>
10
+</Workspace>

+ 8
- 0
example/ios/SafeAreaViewExample.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist View File

@@ -0,0 +1,8 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+<plist version="1.0">
4
+<dict>
5
+	<key>IDEDidComputeMac32BitWarning</key>
6
+	<true/>
7
+</dict>
8
+</plist>

+ 15
- 0
example/ios/SafeAreaViewExample/AppDelegate.h View File

@@ -0,0 +1,15 @@
1
+/**
2
+ * Copyright (c) Facebook, Inc. and its affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+#import <React/RCTBridgeDelegate.h>
9
+#import <UIKit/UIKit.h>
10
+
11
+@interface AppDelegate : UIResponder <UIApplicationDelegate, RCTBridgeDelegate>
12
+
13
+@property (nonatomic, strong) UIWindow *window;
14
+
15
+@end

+ 42
- 0
example/ios/SafeAreaViewExample/AppDelegate.m View File

@@ -0,0 +1,42 @@
1
+/**
2
+ * Copyright (c) Facebook, Inc. and its affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+#import "AppDelegate.h"
9
+
10
+#import <React/RCTBridge.h>
11
+#import <React/RCTBundleURLProvider.h>
12
+#import <React/RCTRootView.h>
13
+
14
+@implementation AppDelegate
15
+
16
+- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
17
+{
18
+  RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
19
+  RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge
20
+                                                   moduleName:@"SafeAreaViewExample"
21
+                                            initialProperties:nil];
22
+
23
+  rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1];
24
+
25
+  self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
26
+  UIViewController *rootViewController = [UIViewController new];
27
+  rootViewController.view = rootView;
28
+  self.window.rootViewController = rootViewController;
29
+  [self.window makeKeyAndVisible];
30
+  return YES;
31
+}
32
+
33
+- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
34
+{
35
+#if DEBUG
36
+  return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"example/index" fallbackResource:nil];
37
+#else
38
+  return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
39
+#endif
40
+}
41
+
42
+@end

+ 42
- 0
example/ios/SafeAreaViewExample/Base.lproj/LaunchScreen.xib View File

@@ -0,0 +1,42 @@
1
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="7702" systemVersion="14D136" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES">
3
+    <dependencies>
4
+        <deployment identifier="iOS"/>
5
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="7701"/>
6
+        <capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/>
7
+    </dependencies>
8
+    <objects>
9
+        <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
10
+        <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
11
+        <view contentMode="scaleToFill" id="iN0-l3-epB">
12
+            <rect key="frame" x="0.0" y="0.0" width="480" height="480"/>
13
+            <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
14
+            <subviews>
15
+                <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Powered by React Native" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="9" translatesAutoresizingMaskIntoConstraints="NO" id="8ie-xW-0ye">
16
+                    <rect key="frame" x="20" y="439" width="441" height="21"/>
17
+                    <fontDescription key="fontDescription" type="system" pointSize="17"/>
18
+                    <color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
19
+                    <nil key="highlightedColor"/>
20
+                </label>
21
+                <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="SafeAreaViewExample" textAlignment="center" lineBreakMode="middleTruncation" baselineAdjustment="alignBaselines" minimumFontSize="18" translatesAutoresizingMaskIntoConstraints="NO" id="kId-c2-rCX">
22
+                    <rect key="frame" x="20" y="140" width="441" height="43"/>
23
+                    <fontDescription key="fontDescription" type="boldSystem" pointSize="36"/>
24
+                    <color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
25
+                    <nil key="highlightedColor"/>
26
+                </label>
27
+            </subviews>
28
+            <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
29
+            <constraints>
30
+                <constraint firstItem="kId-c2-rCX" firstAttribute="centerY" secondItem="iN0-l3-epB" secondAttribute="bottom" multiplier="1/3" constant="1" id="5cJ-9S-tgC"/>
31
+                <constraint firstAttribute="centerX" secondItem="kId-c2-rCX" secondAttribute="centerX" id="Koa-jz-hwk"/>
32
+                <constraint firstAttribute="bottom" secondItem="8ie-xW-0ye" secondAttribute="bottom" constant="20" id="Kzo-t9-V3l"/>
33
+                <constraint firstItem="8ie-xW-0ye" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="20" symbolic="YES" id="MfP-vx-nX0"/>
34
+                <constraint firstAttribute="centerX" secondItem="8ie-xW-0ye" secondAttribute="centerX" id="ZEH-qu-HZ9"/>
35
+                <constraint firstItem="kId-c2-rCX" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="20" symbolic="YES" id="fvb-Df-36g"/>
36
+            </constraints>
37
+            <nil key="simulatedStatusBarMetrics"/>
38
+            <freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
39
+            <point key="canvasLocation" x="548" y="455"/>
40
+        </view>
41
+    </objects>
42
+</document>

+ 38
- 0
example/ios/SafeAreaViewExample/Images.xcassets/AppIcon.appiconset/Contents.json View File

@@ -0,0 +1,38 @@
1
+{
2
+  "images" : [
3
+    {
4
+      "idiom" : "iphone",
5
+      "size" : "29x29",
6
+      "scale" : "2x"
7
+    },
8
+    {
9
+      "idiom" : "iphone",
10
+      "size" : "29x29",
11
+      "scale" : "3x"
12
+    },
13
+    {
14
+      "idiom" : "iphone",
15
+      "size" : "40x40",
16
+      "scale" : "2x"
17
+    },
18
+    {
19
+      "idiom" : "iphone",
20
+      "size" : "40x40",
21
+      "scale" : "3x"
22
+    },
23
+    {
24
+      "idiom" : "iphone",
25
+      "size" : "60x60",
26
+      "scale" : "2x"
27
+    },
28
+    {
29
+      "idiom" : "iphone",
30
+      "size" : "60x60",
31
+      "scale" : "3x"
32
+    }
33
+  ],
34
+  "info" : {
35
+    "version" : 1,
36
+    "author" : "xcode"
37
+  }
38
+}

+ 6
- 0
example/ios/SafeAreaViewExample/Images.xcassets/Contents.json View File

@@ -0,0 +1,6 @@
1
+{
2
+  "info" : {
3
+    "version" : 1,
4
+    "author" : "xcode"
5
+  }
6
+}

+ 57
- 0
example/ios/SafeAreaViewExample/Info.plist View File

@@ -0,0 +1,57 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+<plist version="1.0">
4
+<dict>
5
+	<key>CFBundleDevelopmentRegion</key>
6
+	<string>en</string>
7
+	<key>CFBundleDisplayName</key>
8
+	<string>Hello App Display Name</string>
9
+	<key>CFBundleExecutable</key>
10
+	<string>$(EXECUTABLE_NAME)</string>
11
+	<key>CFBundleIdentifier</key>
12
+	<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
13
+	<key>CFBundleInfoDictionaryVersion</key>
14
+	<string>6.0</string>
15
+	<key>CFBundleName</key>
16
+	<string>$(PRODUCT_NAME)</string>
17
+	<key>CFBundlePackageType</key>
18
+	<string>APPL</string>
19
+	<key>CFBundleShortVersionString</key>
20
+	<string>1.0</string>
21
+	<key>CFBundleSignature</key>
22
+	<string>????</string>
23
+	<key>CFBundleVersion</key>
24
+	<string>1</string>
25
+	<key>LSRequiresIPhoneOS</key>
26
+	<true/>
27
+	<key>NSAppTransportSecurity</key>
28
+	<dict>
29
+		<key>NSAllowsArbitraryLoads</key>
30
+		<true/>
31
+		<key>NSExceptionDomains</key>
32
+		<dict>
33
+			<key>localhost</key>
34
+			<dict>
35
+				<key>NSExceptionAllowsInsecureHTTPLoads</key>
36
+				<true/>
37
+			</dict>
38
+		</dict>
39
+	</dict>
40
+	<key>NSLocationWhenInUseUsageDescription</key>
41
+	<string></string>
42
+	<key>UILaunchStoryboardName</key>
43
+	<string>LaunchScreen</string>
44
+	<key>UIRequiredDeviceCapabilities</key>
45
+	<array>
46
+		<string>armv7</string>
47
+	</array>
48
+	<key>UISupportedInterfaceOrientations</key>
49
+	<array>
50
+		<string>UIInterfaceOrientationPortrait</string>
51
+		<string>UIInterfaceOrientationLandscapeLeft</string>
52
+		<string>UIInterfaceOrientationLandscapeRight</string>
53
+	</array>
54
+	<key>UIViewControllerBasedStatusBarAppearance</key>
55
+	<false/>
56
+</dict>
57
+</plist>

+ 16
- 0
example/ios/SafeAreaViewExample/main.m View File

@@ -0,0 +1,16 @@
1
+/**
2
+ * Copyright (c) Facebook, Inc. and its affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+#import <UIKit/UIKit.h>
9
+
10
+#import "AppDelegate.h"
11
+
12
+int main(int argc, char * argv[]) {
13
+  @autoreleasepool {
14
+    return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
15
+  }
16
+}

+ 290
- 0
ios/SafeAreaView.xcodeproj/project.pbxproj View File

@@ -0,0 +1,290 @@
1
+// !$*UTF8*$!
2
+{
3
+	archiveVersion = 1;
4
+	classes = {
5
+	};
6
+	objectVersion = 46;
7
+	objects = {
8
+
9
+/* Begin PBXBuildFile section */
10
+		19AC186D23048EBB0093B581 /* RNCSafeAreaView.m in Sources */ = {isa = PBXBuildFile; fileRef = 19AC186C23048EBB0093B581 /* RNCSafeAreaView.m */; };
11
+		C923EDBC220C2C1A00D3100F /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C923EDBB220C2C1A00D3100F /* SystemConfiguration.framework */; };
12
+/* End PBXBuildFile section */
13
+
14
+/* Begin PBXCopyFilesBuildPhase section */
15
+		58B511D91A9E6C8500147676 /* CopyFiles */ = {
16
+			isa = PBXCopyFilesBuildPhase;
17
+			buildActionMask = 2147483647;
18
+			dstPath = "include/$(PRODUCT_NAME)";
19
+			dstSubfolderSpec = 16;
20
+			files = (
21
+			);
22
+			runOnlyForDeploymentPostprocessing = 0;
23
+		};
24
+/* End PBXCopyFilesBuildPhase section */
25
+
26
+/* Begin PBXFileReference section */
27
+		134814201AA4EA6300B7C361 /* libRNCNetInfo.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libRNCNetInfo.a; sourceTree = BUILT_PRODUCTS_DIR; };
28
+		19AC186B23048EBB0093B581 /* RNCSafeAreaView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = RNCSafeAreaView.h; path = SafeAreaView/RNCSafeAreaView.h; sourceTree = "<group>"; };
29
+		19AC186C23048EBB0093B581 /* RNCSafeAreaView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = RNCSafeAreaView.m; path = SafeAreaView/RNCSafeAreaView.m; sourceTree = "<group>"; };
30
+		C923EDBB220C2C1A00D3100F /* SystemConfiguration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SystemConfiguration.framework; path = System/Library/Frameworks/SystemConfiguration.framework; sourceTree = SDKROOT; };
31
+/* End PBXFileReference section */
32
+
33
+/* Begin PBXFrameworksBuildPhase section */
34
+		58B511D81A9E6C8500147676 /* Frameworks */ = {
35
+			isa = PBXFrameworksBuildPhase;
36
+			buildActionMask = 2147483647;
37
+			files = (
38
+				C923EDBC220C2C1A00D3100F /* SystemConfiguration.framework in Frameworks */,
39
+			);
40
+			runOnlyForDeploymentPostprocessing = 0;
41
+		};
42
+/* End PBXFrameworksBuildPhase section */
43
+
44
+/* Begin PBXGroup section */
45
+		134814211AA4EA7D00B7C361 /* Products */ = {
46
+			isa = PBXGroup;
47
+			children = (
48
+				134814201AA4EA6300B7C361 /* libRNCNetInfo.a */,
49
+			);
50
+			name = Products;
51
+			sourceTree = "<group>";
52
+		};
53
+		58B511D21A9E6C8500147676 = {
54
+			isa = PBXGroup;
55
+			children = (
56
+				19AC186B23048EBB0093B581 /* RNCSafeAreaView.h */,
57
+				19AC186C23048EBB0093B581 /* RNCSafeAreaView.m */,
58
+				134814211AA4EA7D00B7C361 /* Products */,
59
+				C923EDBA220C2C1A00D3100F /* Frameworks */,
60
+			);
61
+			sourceTree = "<group>";
62
+		};
63
+		C923EDBA220C2C1A00D3100F /* Frameworks */ = {
64
+			isa = PBXGroup;
65
+			children = (
66
+				C923EDBB220C2C1A00D3100F /* SystemConfiguration.framework */,
67
+			);
68
+			name = Frameworks;
69
+			sourceTree = "<group>";
70
+		};
71
+/* End PBXGroup section */
72
+
73
+/* Begin PBXNativeTarget section */
74
+		58B511DA1A9E6C8500147676 /* RNCNetInfo */ = {
75
+			isa = PBXNativeTarget;
76
+			buildConfigurationList = 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "RNCNetInfo" */;
77
+			buildPhases = (
78
+				58B511D71A9E6C8500147676 /* Sources */,
79
+				58B511D81A9E6C8500147676 /* Frameworks */,
80
+				58B511D91A9E6C8500147676 /* CopyFiles */,
81
+			);
82
+			buildRules = (
83
+			);
84
+			dependencies = (
85
+			);
86
+			name = RNCNetInfo;
87
+			productName = RCTDataManager;
88
+			productReference = 134814201AA4EA6300B7C361 /* libRNCNetInfo.a */;
89
+			productType = "com.apple.product-type.library.static";
90
+		};
91
+/* End PBXNativeTarget section */
92
+
93
+/* Begin PBXProject section */
94
+		58B511D31A9E6C8500147676 /* Project object */ = {
95
+			isa = PBXProject;
96
+			attributes = {
97
+				LastUpgradeCheck = 1030;
98
+				ORGANIZATIONNAME = Facebook;
99
+				TargetAttributes = {
100
+					58B511DA1A9E6C8500147676 = {
101
+						CreatedOnToolsVersion = 6.1.1;
102
+					};
103
+				};
104
+			};
105
+			buildConfigurationList = 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "SafeAreaView" */;
106
+			compatibilityVersion = "Xcode 3.2";
107
+			developmentRegion = en;
108
+			hasScannedForEncodings = 0;
109
+			knownRegions = (
110
+				en,
111
+				Base,
112
+			);
113
+			mainGroup = 58B511D21A9E6C8500147676;
114
+			productRefGroup = 58B511D21A9E6C8500147676;
115
+			projectDirPath = "";
116
+			projectRoot = "";
117
+			targets = (
118
+				58B511DA1A9E6C8500147676 /* RNCNetInfo */,
119
+			);
120
+		};
121
+/* End PBXProject section */
122
+
123
+/* Begin PBXSourcesBuildPhase section */
124
+		58B511D71A9E6C8500147676 /* Sources */ = {
125
+			isa = PBXSourcesBuildPhase;
126
+			buildActionMask = 2147483647;
127
+			files = (
128
+				19AC186D23048EBB0093B581 /* RNCSafeAreaView.m in Sources */,
129
+			);
130
+			runOnlyForDeploymentPostprocessing = 0;
131
+		};
132
+/* End PBXSourcesBuildPhase section */
133
+
134
+/* Begin XCBuildConfiguration section */
135
+		58B511ED1A9E6C8500147676 /* Debug */ = {
136
+			isa = XCBuildConfiguration;
137
+			buildSettings = {
138
+				ALWAYS_SEARCH_USER_PATHS = NO;
139
+				CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
140
+				CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
141
+				CLANG_CXX_LIBRARY = "libc++";
142
+				CLANG_ENABLE_MODULES = YES;
143
+				CLANG_ENABLE_OBJC_ARC = YES;
144
+				CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
145
+				CLANG_WARN_BOOL_CONVERSION = YES;
146
+				CLANG_WARN_COMMA = YES;
147
+				CLANG_WARN_CONSTANT_CONVERSION = YES;
148
+				CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
149
+				CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
150
+				CLANG_WARN_EMPTY_BODY = YES;
151
+				CLANG_WARN_ENUM_CONVERSION = YES;
152
+				CLANG_WARN_INFINITE_RECURSION = YES;
153
+				CLANG_WARN_INT_CONVERSION = YES;
154
+				CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
155
+				CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
156
+				CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
157
+				CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
158
+				CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
159
+				CLANG_WARN_STRICT_PROTOTYPES = YES;
160
+				CLANG_WARN_SUSPICIOUS_MOVE = YES;
161
+				CLANG_WARN_UNREACHABLE_CODE = YES;
162
+				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
163
+				COPY_PHASE_STRIP = NO;
164
+				ENABLE_STRICT_OBJC_MSGSEND = YES;
165
+				ENABLE_TESTABILITY = YES;
166
+				GCC_C_LANGUAGE_STANDARD = gnu99;
167
+				GCC_DYNAMIC_NO_PIC = NO;
168
+				GCC_NO_COMMON_BLOCKS = YES;
169
+				GCC_OPTIMIZATION_LEVEL = 0;
170
+				GCC_PREPROCESSOR_DEFINITIONS = (
171
+					"DEBUG=1",
172
+					"$(inherited)",
173
+				);
174
+				GCC_SYMBOLS_PRIVATE_EXTERN = NO;
175
+				GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
176
+				GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
177
+				GCC_WARN_UNDECLARED_SELECTOR = YES;
178
+				GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
179
+				GCC_WARN_UNUSED_FUNCTION = YES;
180
+				GCC_WARN_UNUSED_VARIABLE = YES;
181
+				IPHONEOS_DEPLOYMENT_TARGET = 9.0;
182
+				MTL_ENABLE_DEBUG_INFO = YES;
183
+				ONLY_ACTIVE_ARCH = YES;
184
+				SDKROOT = iphoneos;
185
+			};
186
+			name = Debug;
187
+		};
188
+		58B511EE1A9E6C8500147676 /* Release */ = {
189
+			isa = XCBuildConfiguration;
190
+			buildSettings = {
191
+				ALWAYS_SEARCH_USER_PATHS = NO;
192
+				CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
193
+				CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
194
+				CLANG_CXX_LIBRARY = "libc++";
195
+				CLANG_ENABLE_MODULES = YES;
196
+				CLANG_ENABLE_OBJC_ARC = YES;
197
+				CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
198
+				CLANG_WARN_BOOL_CONVERSION = YES;
199
+				CLANG_WARN_COMMA = YES;
200
+				CLANG_WARN_CONSTANT_CONVERSION = YES;
201
+				CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
202
+				CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
203
+				CLANG_WARN_EMPTY_BODY = YES;
204
+				CLANG_WARN_ENUM_CONVERSION = YES;
205
+				CLANG_WARN_INFINITE_RECURSION = YES;
206
+				CLANG_WARN_INT_CONVERSION = YES;
207
+				CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
208
+				CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
209
+				CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
210
+				CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
211
+				CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
212
+				CLANG_WARN_STRICT_PROTOTYPES = YES;
213
+				CLANG_WARN_SUSPICIOUS_MOVE = YES;
214
+				CLANG_WARN_UNREACHABLE_CODE = YES;
215
+				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
216
+				COPY_PHASE_STRIP = YES;
217
+				ENABLE_NS_ASSERTIONS = NO;
218
+				ENABLE_STRICT_OBJC_MSGSEND = YES;
219
+				GCC_C_LANGUAGE_STANDARD = gnu99;
220
+				GCC_NO_COMMON_BLOCKS = YES;
221
+				GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
222
+				GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
223
+				GCC_WARN_UNDECLARED_SELECTOR = YES;
224
+				GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
225
+				GCC_WARN_UNUSED_FUNCTION = YES;
226
+				GCC_WARN_UNUSED_VARIABLE = YES;
227
+				IPHONEOS_DEPLOYMENT_TARGET = 9.0;
228
+				MTL_ENABLE_DEBUG_INFO = NO;
229
+				SDKROOT = iphoneos;
230
+				VALIDATE_PRODUCT = YES;
231
+			};
232
+			name = Release;
233
+		};
234
+		58B511F01A9E6C8500147676 /* Debug */ = {
235
+			isa = XCBuildConfiguration;
236
+			buildSettings = {
237
+				HEADER_SEARCH_PATHS = (
238
+					"$(inherited)",
239
+					/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
240
+					"$(SRCROOT)/../../../React/**",
241
+					"$(SRCROOT)/../../react-native/React/**",
242
+				);
243
+				LIBRARY_SEARCH_PATHS = "$(inherited)";
244
+				OTHER_LDFLAGS = "-ObjC";
245
+				PRODUCT_NAME = RNCNetInfo;
246
+				SKIP_INSTALL = YES;
247
+			};
248
+			name = Debug;
249
+		};
250
+		58B511F11A9E6C8500147676 /* Release */ = {
251
+			isa = XCBuildConfiguration;
252
+			buildSettings = {
253
+				HEADER_SEARCH_PATHS = (
254
+					"$(inherited)",
255
+					/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
256
+					"$(SRCROOT)/../../../React/**",
257
+					"$(SRCROOT)/../../react-native/React/**",
258
+				);
259
+				LIBRARY_SEARCH_PATHS = "$(inherited)";
260
+				OTHER_LDFLAGS = "-ObjC";
261
+				PRODUCT_NAME = RNCNetInfo;
262
+				SKIP_INSTALL = YES;
263
+			};
264
+			name = Release;
265
+		};
266
+/* End XCBuildConfiguration section */
267
+
268
+/* Begin XCConfigurationList section */
269
+		58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "SafeAreaView" */ = {
270
+			isa = XCConfigurationList;
271
+			buildConfigurations = (
272
+				58B511ED1A9E6C8500147676 /* Debug */,
273
+				58B511EE1A9E6C8500147676 /* Release */,
274
+			);
275
+			defaultConfigurationIsVisible = 0;
276
+			defaultConfigurationName = Release;
277
+		};
278
+		58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "RNCNetInfo" */ = {
279
+			isa = XCConfigurationList;
280
+			buildConfigurations = (
281
+				58B511F01A9E6C8500147676 /* Debug */,
282
+				58B511F11A9E6C8500147676 /* Release */,
283
+			);
284
+			defaultConfigurationIsVisible = 0;
285
+			defaultConfigurationName = Release;
286
+		};
287
+/* End XCConfigurationList section */
288
+	};
289
+	rootObject = 58B511D31A9E6C8500147676 /* Project object */;
290
+}

+ 13
- 0
ios/SafeAreaView/RNCSafeAreaView.h View File

@@ -0,0 +1,13 @@
1
+#import <UIKit/UIKit.h>
2
+
3
+#import <React/RCTView.h>
4
+
5
+NS_ASSUME_NONNULL_BEGIN
6
+
7
+@interface RNCSafeAreaView : RCTView
8
+
9
+@property (nonatomic, copy) RCTBubblingEventBlock onInsetsChange;
10
+
11
+@end
12
+
13
+NS_ASSUME_NONNULL_END

+ 87
- 0
ios/SafeAreaView/RNCSafeAreaView.m View File

@@ -0,0 +1,87 @@
1
+// Simplified version of https://github.com/facebook/react-native/blob/master/React/Views/SafeAreaView/RCTSafeAreaView.m
2
+
3
+#import "RNCSafeAreaView.h"
4
+
5
+#import <React/RCTBridge.h>
6
+#import <React/RCTUIManager.h>
7
+
8
+@implementation RNCSafeAreaView {
9
+  UIEdgeInsets _currentSafeAreaInsets;
10
+}
11
+
12
+RCT_NOT_IMPLEMENTED(- (instancetype)initWithCoder:(NSCoder *)decoder)
13
+RCT_NOT_IMPLEMENTED(- (instancetype)initWithFrame:(CGRect)frame)
14
+
15
+- (BOOL)isSupportedByOS
16
+{
17
+  return [self respondsToSelector:@selector(safeAreaInsets)];
18
+}
19
+
20
+- (UIEdgeInsets)realOrEmulateSafeAreaInsets
21
+{
22
+#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000 /* __IPHONE_11_0 */
23
+  if (self.isSupportedByOS) {
24
+    if (@available(iOS 11.0, *)) {
25
+      return self.safeAreaInsets;
26
+    }
27
+  }
28
+#endif
29
+  return self.emulatedSafeAreaInsets;
30
+}
31
+
32
+- (UIEdgeInsets)emulatedSafeAreaInsets
33
+{
34
+  UIViewController* vc = self.reactViewController;
35
+
36
+  if (!vc) {
37
+    return UIEdgeInsetsZero;
38
+  }
39
+
40
+  CGFloat topLayoutOffset = vc.topLayoutGuide.length;
41
+  CGFloat bottomLayoutOffset = vc.bottomLayoutGuide.length;
42
+  CGRect safeArea = vc.view.bounds;
43
+  safeArea.origin.y += topLayoutOffset;
44
+  safeArea.size.height -= topLayoutOffset + bottomLayoutOffset;
45
+  CGRect localSafeArea = [vc.view convertRect:safeArea toView:self];
46
+  UIEdgeInsets safeAreaInsets = UIEdgeInsetsMake(0, 0, 0, 0);
47
+  if (CGRectGetMinY(localSafeArea) > CGRectGetMinY(self.bounds)) {
48
+    safeAreaInsets.top = CGRectGetMinY(localSafeArea) - CGRectGetMinY(self.bounds);
49
+  }
50
+  if (CGRectGetMaxY(localSafeArea) < CGRectGetMaxY(self.bounds)) {
51
+    safeAreaInsets.bottom = CGRectGetMaxY(self.bounds) - CGRectGetMaxY(localSafeArea);
52
+  }
53
+
54
+  return safeAreaInsets;
55
+}
56
+
57
+static BOOL UIEdgeInsetsEqualToEdgeInsetsWithThreshold(UIEdgeInsets insets1, UIEdgeInsets insets2, CGFloat threshold) {
58
+  return
59
+  ABS(insets1.left - insets2.left) <= threshold &&
60
+  ABS(insets1.right - insets2.right) <= threshold &&
61
+  ABS(insets1.top - insets2.top) <= threshold &&
62
+  ABS(insets1.bottom - insets2.bottom) <= threshold;
63
+}
64
+
65
+- (void)safeAreaInsetsDidChange
66
+{
67
+  [self invalidateSafeAreaInsets];
68
+}
69
+
70
+- (void)invalidateSafeAreaInsets
71
+{
72
+  UIEdgeInsets safeAreaInsets = [self realOrEmulateSafeAreaInsets];
73
+  self.onInsetsChange(@{
74
+    @"top": @(safeAreaInsets.top),
75
+  });
76
+}
77
+
78
+- (void)layoutSubviews
79
+{
80
+  [super layoutSubviews];
81
+
82
+  if (!self.isSupportedByOS) {
83
+    [self invalidateSafeAreaInsets];
84
+  }
85
+}
86
+
87
+@end

+ 17
- 0
metro.config.js View File

@@ -0,0 +1,17 @@
1
+/**
2
+ * Metro configuration for React Native
3
+ * https://github.com/facebook/react-native
4
+ *
5
+ * @format
6
+ */
7
+
8
+module.exports = {
9
+  transformer: {
10
+    getTransformOptions: async () => ({
11
+      transform: {
12
+        experimentalImportSupport: false,
13
+        inlineRequires: false,
14
+      },
15
+    }),
16
+  },
17
+};

+ 51
- 0
package.json View File

@@ -0,0 +1,51 @@
1
+{
2
+  "name": "@th3rdwave/safe-area-view",
3
+  "version": "0.1.0",
4
+  "description": "A more flexible <SafeAreaView>",
5
+  "main": "src/index.ts",
6
+  "files": [
7
+    "/android",
8
+    "!/android/build",
9
+    "/ios",
10
+    "/src",
11
+    "/*.podspec"
12
+  ],
13
+  "author": "Janic Duplessis <janicduplessis@gmail.com>",
14
+  "homepage": "https://github.com/th3rdwave/safe-area-view#readme",
15
+  "license": "MIT",
16
+  "scripts": {
17
+    "start": "react-native start",
18
+    "test": "yarn validate:eslint && yarn validate:typescript",
19
+    "validate:eslint": "eslint \"src/**/*.{js,ts,tsx}\" \"example/**/*.{js,ts,tsx}\"",
20
+    "validate:typescript": "tsc --project ./ --noEmit"
21
+  },
22
+  "keywords": [
23
+    "react-native",
24
+    "react native",
25
+    "safe area",
26
+    "view"
27
+  ],
28
+  "peerDependencies": {
29
+    "react-native": ">=0.59"
30
+  },
31
+  "dependencies": {},
32
+  "devDependencies": {
33
+    "@react-native-community/eslint-config": "^0.0.5",
34
+    "@types/react-native": "^0.60.5",
35
+    "@typescript-eslint/eslint-plugin": "^1.7.0",
36
+    "@typescript-eslint/parser": "^1.7.0",
37
+    "babel-plugin-module-resolver": "^3.2.0",
38
+    "eslint": "5.16.0",
39
+    "eslint-config-prettier": "^4.2.0",
40
+    "eslint-plugin-prettier": "3.0.1",
41
+    "metro-react-native-babel-preset": "^0.55.0",
42
+    "prettier": "^1.18.2",
43
+    "react": "^16.8.3",
44
+    "react-native": "^0.60.5",
45
+    "typescript": "^3.5.3"
46
+  },
47
+  "repository": {
48
+    "type": "git",
49
+    "url": "https://github.com/th3rdwave/safe-area-view.git"
50
+  }
51
+}

+ 226
- 0
src/index.ts View File

@@ -0,0 +1,226 @@
1
+/**
2
+ * Copyright (c) Facebook, Inc. and its affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ * @format
8
+ */
9
+
10
+import {useState, useEffect} from 'react';
11
+import DeprecatedUtils from './internal/deprecatedUtils';
12
+import DeprecatedState from './internal/deprecatedState';
13
+import * as DeprecatedTypes from './internal/deprecatedTypes';
14
+import State from './internal/state';
15
+import * as Types from './internal/types';
16
+
17
+// Call the setup methods of the two state modules right away
18
+State.setup();
19
+DeprecatedState.setup();
20
+
21
+const _isConnectedListeners = new Map<
22
+  DeprecatedTypes.IsConnectedHandler,
23
+  /// @ts-ignore Typescript des not like the trailing comma that Prettier insists upon
24
+  Types.NetInfoChangeHandler
25
+>();
26
+
27
+/**
28
+ * Returns a `Promise` that resolves to a `NetInfoState` object.
29
+ *
30
+ * @returns A Promise which contains the current connection state.
31
+ */
32
+export function fetch(): Promise<Types.NetInfoState> {
33
+  return State.latest();
34
+}
35
+
36
+/**
37
+ * Subscribe to connection information. The callback is called with a parameter of type
38
+ * [`NetInfoState`](README.md#netinfostate) whenever the connection state changes. Your listener
39
+ * will be called with the latest information soon after you subscribe and then with any
40
+ * subsequent changes afterwards. You should not assume that the listener is called in the same
41
+ * way across devices or platforms.
42
+ *
43
+ * @param listener The listener which is called when the network state changes.
44
+ *
45
+ * @returns An ofunction which can be called to unsubscribe.
46
+ */
47
+export function addEventListener(
48
+  listener: Types.NetInfoChangeHandler,
49
+): Types.NetInfoSubscription;
50
+
51
+/**
52
+ * Deprecated network state listener. You should remove the event name and change your handler to
53
+ * use the new state shape.
54
+ *
55
+ * @deprecated
56
+ *
57
+ * @param type The event type.
58
+ * @param deprecatedHandler The listener.
59
+ *
60
+ * @returns An object with a remove function which can be called to unsubscribe.
61
+ */
62
+export function addEventListener(
63
+  type: string,
64
+  deprecatedHandler: DeprecatedTypes.ChangeHandler,
65
+): DeprecatedTypes.Subscription;
66
+
67
+// Implementation of the overloaded methods above
68
+export function addEventListener(
69
+  listenerOrType: Types.NetInfoChangeHandler | string,
70
+  deprecatedHandler: DeprecatedTypes.ChangeHandler | undefined = undefined,
71
+): Types.NetInfoSubscription | DeprecatedTypes.Subscription {
72
+  if (typeof listenerOrType === 'string') {
73
+    DeprecatedUtils.warnOnce();
74
+
75
+    if (
76
+      listenerOrType === DeprecatedTypes.CHANGE_EVENT_NAME &&
77
+      deprecatedHandler
78
+    ) {
79
+      DeprecatedState.add(deprecatedHandler);
80
+      return {
81
+        remove: (): void => {
82
+          DeprecatedState.remove(deprecatedHandler);
83
+        },
84
+      };
85
+    } else {
86
+      return {
87
+        remove: (): void => {},
88
+      };
89
+    }
90
+  } else {
91
+    const listener = listenerOrType;
92
+    State.add(listener);
93
+    return (): void => {
94
+      State.remove(listener);
95
+    };
96
+  }
97
+}
98
+
99
+/**
100
+ * A React Hook which updates when the connection state changes.
101
+ *
102
+ * @returns The connection state.
103
+ */
104
+export function useNetInfo(): Types.NetInfoState {
105
+  const [netInfo, setNetInfo] = useState<Types.NetInfoState>({
106
+    type: Types.NetInfoStateType.unknown,
107
+    isConnected: false,
108
+    isInternetReachable: false,
109
+    details: null,
110
+  });
111
+
112
+  useEffect((): (() => void) => {
113
+    return addEventListener(setNetInfo);
114
+  }, []);
115
+
116
+  return netInfo;
117
+}
118
+
119
+/**
120
+ * Deprecated method to remove the listener. You should upgrade to the new API.
121
+ *
122
+ * @deprecated
123
+ *
124
+ * @param type The event type.
125
+ * @param handler The event listener.
126
+ */
127
+export function removeEventListener(
128
+  type: string,
129
+  handler: DeprecatedTypes.ChangeHandler,
130
+): void {
131
+  DeprecatedUtils.warnOnce();
132
+
133
+  if (type === DeprecatedTypes.CHANGE_EVENT_NAME) {
134
+    DeprecatedState.remove(handler);
135
+  }
136
+}
137
+
138
+/**
139
+ * Deprecated method to get the current state. You should upgrade to the new `fetch` method and
140
+ * handle the new state type.
141
+ *
142
+ * @deprecated
143
+ */
144
+export function getConnectionInfo(): Promise<DeprecatedTypes.NetInfoData> {
145
+  DeprecatedUtils.warnOnce();
146
+  return DeprecatedState.latest();
147
+}
148
+
149
+/**
150
+ * Deprecated method to tell if the current connection is "expensive". Only available on Android.
151
+ * You should now call the `fetch` method and look at the `details.isConnectionExpensive` property.
152
+ *
153
+ * @deprecated
154
+ */
155
+export function isConnectionExpensive(): Promise<boolean> {
156
+  DeprecatedUtils.warnOnce();
157
+  return State.latest().then(DeprecatedUtils.isConnectionExpensive);
158
+}
159
+
160
+export const isConnected = {
161
+  /**
162
+   * Deprecated method to listen for changes to the connected boolean. You should now use the
163
+   * normal `addEventListener` method and look at the `isConnected` property.
164
+   *
165
+   * @deprecated
166
+   */
167
+  addEventListener: (
168
+    eventName: string,
169
+    handler: DeprecatedTypes.IsConnectedHandler,
170
+  ): DeprecatedTypes.Subscription => {
171
+    if (eventName !== DeprecatedTypes.CHANGE_EVENT_NAME) {
172
+      return {remove: (): void => {}};
173
+    }
174
+
175
+    const listener = (state: Types.NetInfoState): void => {
176
+      handler(DeprecatedUtils.isConnected(state));
177
+    };
178
+
179
+    _isConnectedListeners.set(handler, listener);
180
+    State.add(listener);
181
+
182
+    return {
183
+      remove: (): void => {
184
+        State.remove(listener);
185
+      },
186
+    };
187
+  },
188
+
189
+  /**
190
+   * Deprecated method to stop listening for changes to the connected boolean. You should now use
191
+   * the normal `addEventListener` method and look at the `isConnected` property.
192
+   *
193
+   * @deprecated
194
+   */
195
+  removeEventListener: (
196
+    _eventName: string,
197
+    handler: DeprecatedTypes.IsConnectedHandler,
198
+  ): void => {
199
+    const listener = _isConnectedListeners.get(handler);
200
+    listener && State.remove(listener);
201
+    _isConnectedListeners.delete(handler);
202
+  },
203
+
204
+  /**
205
+   * Deprecated method to get the current is connected boolean. You should now use the normal
206
+   * `fetch` method and look at the `isConnected` property.
207
+   *
208
+   * @deprecated
209
+   */
210
+  fetch: (): Promise<boolean> => {
211
+    return State.latest().then(DeprecatedUtils.isConnected);
212
+  },
213
+};
214
+
215
+export * from './internal/types';
216
+export * from './internal/deprecatedTypes';
217
+
218
+export default {
219
+  fetch,
220
+  addEventListener,
221
+  useNetInfo,
222
+  removeEventListener,
223
+  getConnectionInfo,
224
+  isConnectionExpensive,
225
+  isConnected,
226
+};

+ 19
- 0
th3rdwave-safe-area-view.podspec View File

@@ -0,0 +1,19 @@
1
+require 'json'
2
+
3
+package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
4
+
5
+Pod::Spec.new do |s|
6
+  s.name         = "th3rdwave-safe-area-view"
7
+  s.version      = package['version']
8
+  s.summary      = package['description']
9
+  s.license      = package['license']
10
+
11
+  s.authors      = package['author']
12
+  s.homepage     = package['homepage']
13
+  s.platforms    = { :ios => "9.0", :tvos => "9.2" }
14
+
15
+  s.source       = { :git => "https://github.com/th3rdwave/safe-area-view.git", :tag => "v#{s.version}" }
16
+  s.source_files  = "ios/**/*.{h,m}"
17
+
18
+  s.dependency 'React'
19
+end

+ 17
- 0
tsconfig.json View File

@@ -0,0 +1,17 @@
1
+{
2
+  "include": [
3
+    "src/**/*.ts",
4
+    "src/**/*.tsx",
5
+    "example/**/*.ts",
6
+    "example/**/*.tsx"
7
+  ],
8
+  "compilerOptions": {
9
+    "target": "es5",
10
+    "module": "commonjs",
11
+    "strict": true,
12
+    "moduleResolution": "node",
13
+    "lib": ["es2015", "es2016", "esnext"],
14
+    "jsx": "react-native"
15
+  },
16
+  "exclude": ["node_modules"]
17
+}

+ 5460
- 0
yarn.lock
File diff suppressed because it is too large
View File