Skip to content

Commit

Permalink
[safe-area-context] Update to 3.0.2 (#8549)
Browse files Browse the repository at this point in the history
* [safe-area-context] Update to 3.0.2

* Update CHANGELOG, remove a couple of PRs from safe-area-context

* Update CHANGELOG.md

Co-authored-by: Tomasz Sapeta <1714764+tsapeta@users.noreply.github.com>

Co-authored-by: Tomasz Sapeta <1714764+tsapeta@users.noreply.github.com>
  • Loading branch information
brentvatne and tsapeta committed May 28, 2020
1 parent 6aa6f0b commit 8631bbb
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 13 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Expand Up @@ -11,7 +11,7 @@ Package-specific changes not released in any SDK will be added here just before
- Updated `react-native-screens` from `2.2.0` to `2.8.0`. ([#8434](https://github.com/expo/expo/pull/8424) by [@sjchmiela](https://github.com/sjchmiela))
- Updated `react-native-shared-element` from `0.5.6` to `0.7.0`. ([#8427](https://github.com/expo/expo/pull/8427) by [@IjzerenHein](https://github.com/IjzerenHein))
- Updated `react-native-reanimated` from `1.7.0` to `1.9.0`. ([#8424](https://github.com/expo/expo/pull/8424) by [@sjchmiela](https://github.com/sjchmiela))
- Updated `react-native-safe-area-context` from `0.7.3` to `3.0.0`. ([#8459](https://github.com/expo/expo/pull/8459) by [@brentvatne](https://github.com/brentvatne) and [#8479](https://github.com/expo/expo/pull/8479) by [@tsapeta](https://github.com/tsapeta)) and [#8503](https://github.com/expo/expo/pull/8459) by [@brentvatne](https://github.com/brentvatne) and [#8544](https://github.com/expo/expo/pull/8544) by [@brentvatne](https://github.com/brentvatne).
- Updated `react-native-safe-area-context` from `0.7.3` to `3.0.0`. ([#8459](https://github.com/expo/expo/pull/8459), [#8479](https://github.com/expo/expo/pull/8479), [#8549](https://github.com/expo/expo/pull/8549) by [@brentvatne](https://github.com/brentvatne) and [@tsapeta](https://github.com/tsapeta))
- Updated `@react-native-community/datetimepicker` from `2.2.2` to `2.4.0`. ([#8476](https://github.com/expo/expo/pull/8476) by [@tsapeta](https://github.com/tsapeta))
- Updated `react-native-webview` from `8.1.1` to `9.4.0`. ([#8489](https://github.com/expo/expo/pull/8489) by [@tsapeta](https://github.com/tsapeta))
- Updated `react-native-svg` from `11.0.1` to `12.1.0`. ([#8491](https://github.com/expo/expo/pull/8491) by [@tsapeta](https://github.com/tsapeta))
Expand Down
Expand Up @@ -3,6 +3,7 @@
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.ContextWrapper;
import android.util.Log;
import android.view.View;
import android.view.ViewParent;
import android.view.ViewTreeObserver;
Expand Down Expand Up @@ -55,14 +56,18 @@ private void updateInsets() {
}
}

// 5 seconds
private static final long MAX_WAIT_TIME_NANO = 5000000000L;

private void waitForReactLayout() {
// Block the main thread until the native module thread is finished with
// its current tasks. To do this we use the done boolean as a lock and enqueue
// a task on the native modules thread. When the task runs we can unblock the
// main thread. This should be safe as long as the native modules thread
// does not block waiting on the main thread.
// TODO: Investigate perf impact.
final AtomicBoolean done = new AtomicBoolean(false);
final long startTime = System.nanoTime();
long waitTime = 0L;
getReactContext(this).runOnNativeModulesQueueThread(new Runnable() {
@Override
public void run() {
Expand All @@ -73,12 +78,17 @@ public void run() {
}
});
synchronized (done) {
while (!done.get()) {
while (!done.get() && waitTime < MAX_WAIT_TIME_NANO) {
try {
done.wait();
done.wait(MAX_WAIT_TIME_NANO / 1000000L);
} catch (InterruptedException e) {
e.printStackTrace();
}
waitTime = System.nanoTime() - startTime;
}
// Timed out waiting.
if (waitTime >= MAX_WAIT_TIME_NANO) {
Log.w("SafeAreaView", "Timed out waiting for layout.");
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion apps/bare-expo/package.json
Expand Up @@ -92,7 +92,7 @@
"react-native-appearance": "~0.3.3",
"react-native-gesture-handler": "~1.6.0",
"react-native-reanimated": "~1.9.0",
"react-native-safe-area-context": "3.0.0",
"react-native-safe-area-context": "3.0.2",
"react-native-screens": "~2.8.0",
"react-native-unimodules": "~0.10.0",
"react-native-web": "^0.11.4",
Expand Down
2 changes: 1 addition & 1 deletion apps/native-component-list/package.json
Expand Up @@ -92,7 +92,7 @@
"react-native-paper": "github:brentvatne/react-native-paper#@brent/fix-bottom-navigation-rn-57",
"react-native-platform-touchable": "^1.1.1",
"react-native-reanimated": "~1.9.0",
"react-native-safe-area-context": "3.0.0",
"react-native-safe-area-context": "3.0.2",
"react-native-safe-area-view": "^0.14.8",
"react-native-screens": "~2.8.0",
"react-native-shared-element": "0.7.0",
Expand Down
2 changes: 1 addition & 1 deletion home/package.json
Expand Up @@ -51,7 +51,7 @@
"react-native-gesture-handler": "~1.6.0",
"react-native-infinite-scroll-view": "^0.4.5",
"react-native-maps": "0.27.1",
"react-native-safe-area-context": "3.0.0",
"react-native-safe-area-context": "3.0.2",
"react-navigation": "4.1.0-alpha.1",
"react-navigation-material-bottom-tabs": "1.1.1",
"react-navigation-stack": "^2.0.15",
Expand Down
2 changes: 1 addition & 1 deletion packages/expo/bundledNativeModules.json
Expand Up @@ -79,7 +79,7 @@
"expo-in-app-purchases": "~8.2.0",
"expo-branch": "~2.2.0",
"react-native-appearance": "~0.3.3",
"react-native-safe-area-context": "3.0.0",
"react-native-safe-area-context": "3.0.2",
"react-native-shared-element": "0.7.0",
"expo-application": "~2.2.1",
"expo-battery": "~2.2.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/expo/package.json
Expand Up @@ -75,7 +75,7 @@
"nullthrows": "^1.1.0",
"pretty-format": "^23.6.0",
"prop-types": "^15.6.0",
"react-native-safe-area-context": "3.0.0",
"react-native-safe-area-context": "3.0.2",
"serialize-error": "^2.1.0",
"unimodules-app-loader": "~1.1.0",
"unimodules-barcode-scanner-interface": "~5.2.0",
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Expand Up @@ -13949,10 +13949,10 @@ react-native-reanimated@~1.9.0:
dependencies:
fbjs "^1.0.0"

react-native-safe-area-context@3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/react-native-safe-area-context/-/react-native-safe-area-context-3.0.0.tgz#09a326aa2713b830cfe0451ed7649f5d9cf2aa65"
integrity sha512-98ZeGgtr2YxPJUzL5tgh7v3kcvnD5iPT+2RS5inn40dkPPPsBNXqcqkBiQyWIvfBCahQfwXH2PA2diX+AUz16A==
react-native-safe-area-context@3.0.2:
version "3.0.2"
resolved "https://registry.yarnpkg.com/react-native-safe-area-context/-/react-native-safe-area-context-3.0.2.tgz#95dd7e56bc89bcc4f3f7bb5fada30c98420328b2"
integrity sha512-x3yVMsxwe9GyvIkv0Q5jy2CWYN7VO0/CJTFGG5kSiMo8FFTQJbWtuWGANFqxDzEH5NEV7/SfK+qTgAh931KyUw==

react-native-safe-area-view@^0.14, react-native-safe-area-view@^0.14.8, react-native-safe-area-view@^0.14.9:
version "0.14.9"
Expand Down

0 comments on commit 8631bbb

Please sign in to comment.