Skip to content

Instantly share code, notes, and snippets.

@brunolemos
Last active January 14, 2021 05:07
Show Gist options
  • Save brunolemos/ec886065b695d54ba25af7de47475c90 to your computer and use it in GitHub Desktop.
Save brunolemos/ec886065b695d54ba25af7de47475c90 to your computer and use it in GitHub Desktop.
react-native-safe-area-context
import React from 'react'
import { StatusBar, Text, View } from 'react-native'
import { useSafeArea } from 'react-native-safe-area-context'
export function App() {
const safeAreaInsets = useSafeArea()
return (
<View
style={{
flex: 1,
backgroundColor: '#ffca28',
paddingTop: safeAreaInsets.top,
paddingBottom: safeAreaInsets.bottom,
paddingLeft: safeAreaInsets.left,
paddingRight: safeAreaInsets.right,
}}
>
<StatusBar backgroundColor="#7cb342" />
<Text style={{ color: 'black', textAlign: 'center' }}>Top</Text>
<View
style={{
flex: 1,
flexDirection: 'row',
alignItems: 'center',
justifyContent: 'space-between',
}}
>
<Text style={{ color: 'black', textAlign: 'center' }}>Left</Text>
<Text style={{ color: 'black', textAlign: 'center' }}>Right</Text>
</View>
<Text style={{ color: 'black', textAlign: 'center' }}>Bottom</Text>
</View>
)
}
diff --git a/node_modules/react-native-safe-area-context/android/gradle.properties b/node_modules/react-native-safe-area-context/android/gradle.properties
index c9d3fbb..9880579 100755
--- a/node_modules/react-native-safe-area-context/android/gradle.properties
+++ b/node_modules/react-native-safe-area-context/android/gradle.properties
@@ -2,5 +2,5 @@ ReactNativeSafeAreaView_compileSdkVersion=28
ReactNativeSafeAreaView_buildToolsVersion=28.0.3
ReactNativeSafeAreaView_targetSdkVersion=27
ReactNativeSafeAreaView_minSdkVersion=16
-android.useAndroidX=true
-android.enableJetifier=true
+android.useAndroidX=false
+android.enableJetifier=false
diff --git a/node_modules/react-native-safe-area-context/android/src/main/java/com/th3rdwave/safeareacontext/SafeAreaView.java b/node_modules/react-native-safe-area-context/android/src/main/java/com/th3rdwave/safeareacontext/SafeAreaView.java
index 8701a35..ab3c44c 100644
--- a/node_modules/react-native-safe-area-context/android/src/main/java/com/th3rdwave/safeareacontext/SafeAreaView.java
+++ b/node_modules/react-native-safe-area-context/android/src/main/java/com/th3rdwave/safeareacontext/SafeAreaView.java
@@ -13,7 +13,7 @@ import android.view.WindowManager;
import com.facebook.infer.annotation.Assertions;
import com.facebook.react.views.view.ReactViewGroup;
-import androidx.annotation.Nullable;
+import javax.annotation.Nullable;
public class SafeAreaView extends ReactViewGroup implements ViewTreeObserver.OnGlobalLayoutListener {
public interface OnInsetsChangeListener {
diff --git a/node_modules/react-native-safe-area-context/android/src/main/java/com/th3rdwave/safeareacontext/SafeAreaViewManager.java b/node_modules/react-native-safe-area-context/android/src/main/java/com/th3rdwave/safeareacontext/SafeAreaViewManager.java
index dcc2a8c..b1f7861 100644
--- a/node_modules/react-native-safe-area-context/android/src/main/java/com/th3rdwave/safeareacontext/SafeAreaViewManager.java
+++ b/node_modules/react-native-safe-area-context/android/src/main/java/com/th3rdwave/safeareacontext/SafeAreaViewManager.java
@@ -8,23 +8,23 @@ import com.facebook.react.uimanager.events.EventDispatcher;
import java.util.Map;
-import androidx.annotation.NonNull;
+import javax.annotation.Nonnull;
public class SafeAreaViewManager extends ViewGroupManager<SafeAreaView> {
@Override
- @NonNull
+ @Nonnull
public String getName() {
return "RNCSafeAreaView";
}
@Override
- @NonNull
- public SafeAreaView createViewInstance(@NonNull ThemedReactContext context) {
+ @Nonnull
+ public SafeAreaView createViewInstance(@Nonnull ThemedReactContext context) {
return new SafeAreaView(context);
}
@Override
- protected void addEventEmitters(@NonNull ThemedReactContext reactContext, @NonNull final SafeAreaView view) {
+ protected void addEventEmitters(@Nonnull ThemedReactContext reactContext, @Nonnull final SafeAreaView view) {
final EventDispatcher dispatcher =
reactContext.getNativeModule(UIManagerModule.class).getEventDispatcher();
view.setOnInsetsChangeListener(new SafeAreaView.OnInsetsChangeListener() {
diff --git a/node_modules/react-native-safe-area-context/ios/.DS_Store b/node_modules/react-native-safe-area-context/ios/.DS_Store
index 1f44500..f0e33d4 100644
Binary files a/node_modules/react-native-safe-area-context/ios/.DS_Store and b/node_modules/react-native-safe-area-context/ios/.DS_Store differ
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment