Skip to content

Commit

Permalink
Merge branch 'main' into @kkafar/fabric-pressables
Browse files Browse the repository at this point in the history
  • Loading branch information
alduzy authored Aug 20, 2024
2 parents 6a61a6c + c47ad84 commit aba1646
Show file tree
Hide file tree
Showing 158 changed files with 18,944 additions and 530 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/docs-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Publish Screens landing page
env:
YARN_ENABLE_HARDENED_MODE: 0
on:
push:
branches:
- main
paths: docs/**
workflow_dispatch:

jobs:
publish:
if: github.repository == 'software-mansion/react-native-screens'
runs-on: ubuntu-latest
concurrency:
group: docs-check-${{ github.ref }}
cancel-in-progress: true
steps:
- name: Check out
uses: actions/checkout@v4

- name: Generate landing page content
run: >-
git config --local user.email "[email protected]"
&& git config --local user.name "GitHub Action"
&& cd docs
&& yarn
&& yarn build
- name: Publish generated content to GitHub Pages
uses: JamesIves/github-pages-deploy-action@releases/v3
with:
FOLDER: docs/build
BRANCH: gh-pages
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1 change: 1 addition & 0 deletions Example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"@react-navigation/native-stack": "link:../react-navigation/packages/native-stack/",
"@react-navigation/routers": "link:../react-navigation/packages/routers/",
"@react-navigation/stack": "link:../react-navigation/packages/stack/",
"jotai": "^2.9.0",
"nanoid": "^4.0.2",
"react": "18.3.1",
"react-native": "0.75.0-rc.6",
Expand Down
16 changes: 16 additions & 0 deletions Example/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3806,6 +3806,7 @@ __metadata:
eslint: "npm:^8.19.0"
glob-to-regexp: "npm:^0.4.1"
jest: "npm:^29.6.3"
jotai: "npm:^2.9.0"
metro-react-native-babel-preset: "npm:^0.76.8"
nanoid: "npm:^4.0.2"
patch-package: "npm:^8.0.0"
Expand Down Expand Up @@ -8163,6 +8164,21 @@ __metadata:
languageName: node
linkType: hard

"jotai@npm:^2.9.0":
version: 2.9.0
resolution: "jotai@npm:2.9.0"
peerDependencies:
"@types/react": ">=17.0.0"
react: ">=17.0.0"
peerDependenciesMeta:
"@types/react":
optional: true
react:
optional: true
checksum: 10c0/c5551fb90933bcbc28b11cdb4af681398a12f8eb39a4a49568ec6ce5062c2257dd84a85cbfd7ec7d970d56dfa5023d16a0ec7056bc2697fdf9b3ec94da67c9d1
languageName: node
linkType: hard

"js-message@npm:1.0.7":
version: 1.0.7
resolution: "js-message@npm:1.0.7"
Expand Down
8 changes: 4 additions & 4 deletions FabricExample/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -75,21 +75,21 @@ GEM
netrc (0.11.0)
nkf (0.2.0)
public_suffix (4.0.7)
rexml (3.2.8)
strscan (>= 3.0.9)
rexml (3.3.3)
strscan
ruby-macho (2.5.1)
strscan (3.1.0)
typhoeus (1.4.1)
ethon (>= 0.9.0)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
xcodeproj (1.24.0)
xcodeproj (1.25.0)
CFPropertyList (>= 2.3.3, < 4.0)
atomos (~> 0.1.3)
claide (>= 1.0.2, < 2.0)
colored2 (~> 3.1)
nanaimo (~> 0.3.0)
rexml (~> 3.2.4)
rexml (>= 3.3.2, < 4.0)

PLATFORMS
ruby
Expand Down
1 change: 1 addition & 0 deletions FabricExample/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"@react-navigation/native-stack": "link:../react-navigation/packages/native-stack/",
"@react-navigation/routers": "link:../react-navigation/packages/routers/",
"@react-navigation/stack": "link:../react-navigation/packages/stack/",
"jotai": "^2.9.0",
"nanoid": "^4.0.2",
"react": "18.3.1",
"react-native": "0.75.0-rc.6",
Expand Down
16 changes: 16 additions & 0 deletions FabricExample/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3344,6 +3344,7 @@ __metadata:
babel-jest: "npm:^29.6.3"
eslint: "npm:^8.19.0"
jest: "npm:^29.6.3"
jotai: "npm:^2.9.0"
nanoid: "npm:^4.0.2"
patch-package: "npm:^8.0.0"
prettier: "npm:2.8.8"
Expand Down Expand Up @@ -6799,6 +6800,21 @@ __metadata:
languageName: node
linkType: hard

"jotai@npm:^2.9.0":
version: 2.9.0
resolution: "jotai@npm:2.9.0"
peerDependencies:
"@types/react": ">=17.0.0"
react: ">=17.0.0"
peerDependenciesMeta:
"@types/react":
optional: true
react:
optional: true
checksum: 10c0/c5551fb90933bcbc28b11cdb4af681398a12f8eb39a4a49568ec6ce5062c2257dd84a85cbfd7ec7d970d56dfa5023d16a0ec7056bc2697fdf9b3ec94da67c9d1
languageName: node
linkType: hard

"js-tokens@npm:^3.0.0 || ^4.0.0, js-tokens@npm:^4.0.0":
version: 4.0.0
resolution: "js-tokens@npm:4.0.0"
Expand Down
4 changes: 2 additions & 2 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,8 @@ repositories {

dependencies {
implementation 'com.facebook.react:react-native:+'
implementation 'androidx.appcompat:appcompat:1.4.2'
implementation 'androidx.fragment:fragment:1.3.6'
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'androidx.fragment:fragment-ktx:1.6.1'
implementation 'androidx.coordinatorlayout:coordinatorlayout:1.2.0'
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
implementation 'com.google.android.material:material:1.6.1'
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
package com.swmansion.rnscreens

import android.view.View
import androidx.core.view.OnApplyWindowInsetsListener
import androidx.core.view.ViewCompat
import androidx.core.view.WindowInsetsCompat
import java.lang.ref.WeakReference

object InsetsObserverProxy : OnApplyWindowInsetsListener {
private val listeners: ArrayList<OnApplyWindowInsetsListener> = arrayListOf()
private var eventSourceView: WeakReference<View> = WeakReference(null)

// Please note semantics of this property. This is not `isRegistered`, because somebody, could unregister
// us, without our knowledge, e.g. reanimated or different 3rd party library. This holds only information
// whether this observer has been initially registered.
private var hasBeenRegistered: Boolean = false

private var shouldForwardInsetsToView = true

override fun onApplyWindowInsets(
v: View,
insets: WindowInsetsCompat,
): WindowInsetsCompat {
var rollingInsets =
if (shouldForwardInsetsToView) {
WindowInsetsCompat.toWindowInsetsCompat(
v.onApplyWindowInsets(insets.toWindowInsets()),
v,
)
} else {
insets
}

listeners.forEach {
rollingInsets = it.onApplyWindowInsets(v, insets)
}
return rollingInsets
}

fun addOnApplyWindowInsetsListener(listener: OnApplyWindowInsetsListener) {
listeners.add(listener)
}

fun removeOnApplyWindowInsetsListener(listener: OnApplyWindowInsetsListener) {
listeners.remove(listener)
}

fun registerOnView(view: View) {
if (!hasBeenRegistered) {
ViewCompat.setOnApplyWindowInsetsListener(view, this)
eventSourceView = WeakReference(view)
hasBeenRegistered = true
} else if (getObservedView() != view) {
throw IllegalStateException(
"[RNScreens] Attempt to register InsetsObserverProxy on $view while it has been already registered on ${getObservedView()}",
)
}
}

fun unregister() {
eventSourceView.get()?.takeIf { hasBeenRegistered }?.let {
ViewCompat.setOnApplyWindowInsetsListener(it, null)
}
}

private fun getObservedView(): View? = eventSourceView.get()
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ class RNScreensPackage : TurboReactPackage() {
ScreenStackHeaderConfigViewManager(),
ScreenStackHeaderSubviewManager(),
SearchBarManager(),
ScreenFooterManager(),
ScreenContentWrapperManager(),
)
}

Expand Down
Loading

0 comments on commit aba1646

Please sign in to comment.