Skip to content

Commit

Permalink
refactor: iOS impl from Swift to ObjC++, bump example to 0.73
Browse files Browse the repository at this point in the history
  • Loading branch information
mateusz1913 committed Jan 5, 2024
1 parent dd058da commit 8eb1db7
Show file tree
Hide file tree
Showing 149 changed files with 13,576 additions and 12,613 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/lint-android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@ jobs:
distribution: 'temurin'
java-version: '17'
- run: yarn
- name: Spotless/Ktlint
- name: Spotless/Ktfmt
run: yarn lint:android
20 changes: 16 additions & 4 deletions .github/workflows/lint-ios.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,18 @@ jobs:
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: "**/node_modules"
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
- name: Install modules
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: "yarn"
registry-url: "https://registry.npmjs.org"
cache-dependency-path: "**/yarn.lock"
- run: yarn
- name: SwiftLint
run: |
#!/bin/bash
Expand All @@ -23,8 +35,8 @@ jobs:
echo "SwiftLint is not installed. Installing"
brew install swiftlint
fi
swiftlint lint --config ./packages/mobile/ios/.swiftlint.yml --quiet
swiftlint lint --config ./packages/fabricMobile/ios/.swiftlint.yml --quiet
yarn lint:ios:swift
yarn lint:fabric:ios:swift
- name: ClangFormat
run: |
#!/bin/bash
Expand All @@ -33,5 +45,5 @@ jobs:
echo "ClangFormat is not installed. Installing"
brew install clang-format
fi
clang-format --dry-run -i ./packages/react-native-avoid-softinput/ios/*.{h,mm} ./packages/mobile/ios/AvoidSoftinputExample/*.{h,mm} -Werror
clang-format --dry-run -i ./packages/react-native-avoid-softinput/ios/*.{h,mm} ./packages/fabricMobile/ios/FabricAvoidSoftinputExample/*.{h,mm} -Werror
yarn format:ios:objc
yarn format:fabric:ios:objc
9 changes: 9 additions & 0 deletions .yarn/plugins/@yarnpkg/plugin-after-install.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/* eslint-disable */
//prettier-ignore
module.exports = {
name: "@yarnpkg/plugin-after-install",
factory: function (require) {
"use strict";var plugin=(()=>{var s=Object.defineProperty;var g=Object.getOwnPropertyDescriptor;var x=Object.getOwnPropertyNames;var C=Object.prototype.hasOwnProperty;var r=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(o,e)=>(typeof require<"u"?require:o)[e]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw new Error('Dynamic require of "'+t+'" is not supported')});var I=(t,o)=>{for(var e in o)s(t,e,{get:o[e],enumerable:!0})},h=(t,o,e,a)=>{if(o&&typeof o=="object"||typeof o=="function")for(let n of x(o))!C.call(t,n)&&n!==e&&s(t,n,{get:()=>o[n],enumerable:!(a=g(o,n))||a.enumerable});return t};var k=t=>h(s({},"__esModule",{value:!0}),t);var P={};I(P,{default:()=>y});var d=r("@yarnpkg/core");var f=r("@yarnpkg/core"),c={afterInstall:{description:"Hook that will always run after install",type:f.SettingsType.STRING,default:""}};var p=r("clipanion"),u=r("@yarnpkg/core");var m=r("@yarnpkg/shell"),l=async(t,o)=>{let e=t.get("afterInstall"),a=!!t.projectCwd?.endsWith(`dlx-${process.pid}`);return e&&!a?(o&&console.log("Running `afterInstall` hook..."),(0,m.execute)(e,[],{cwd:t.projectCwd||void 0})):0};var i=class extends p.Command{async execute(){let o=await u.Configuration.find(this.context.cwd,this.context.plugins);return l(o,!1)}};i.paths=[["after-install"]];var w={configuration:c,commands:[i],hooks:{afterAllInstalled:async(t,o)=>{if(o?.mode===d.InstallMode.UpdateLockfile)return;if(await l(t.configuration,!0))throw new Error("The `afterInstall` hook failed, see output above.")}}},y=w;return k(P);})();
return plugin;
}
};
8 changes: 0 additions & 8 deletions .yarn/plugins/@yarnpkg/plugin-postinstall.cjs

This file was deleted.

874 changes: 0 additions & 874 deletions .yarn/releases/yarn-3.6.4.cjs

This file was deleted.

893 changes: 893 additions & 0 deletions .yarn/releases/yarn-4.0.2.cjs

Large diffs are not rendered by default.

14 changes: 9 additions & 5 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
afterInstall: "yarn pods:mobile && yarn pods:fabricMobile"

compressionLevel: mixed

enableGlobalCache: false

nodeLinker: node-modules

plugins:
- path: .yarn/plugins/@yarnpkg/plugin-postinstall.cjs
spec: "https://raw.githubusercontent.com/gravitywelluk/yarn-plugin-postinstall/master/bundles/%40yarnpkg/plugin-postinstall.js"

postinstall: "yarn pods:mobile && yarn pods:fabricMobile"
- path: .yarn/plugins/@yarnpkg/plugin-after-install.cjs
spec: "https://raw.githubusercontent.com/mhassan1/yarn-plugin-after-install/v0.6.0/bundles/@yarnpkg/plugin-after-install.js"

yarnPath: .yarn/releases/yarn-3.6.4.cjs
yarnPath: .yarn/releases/yarn-4.0.2.cjs
2 changes: 1 addition & 1 deletion docs/.yarnrc.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
postinstall: echo "No postinstall for docs project"
afterInstall: echo "No postinstall for docs project"
16 changes: 2 additions & 14 deletions docs/docs/recipes/BOTTOM_SHEET.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ This example assumes the bottom sheet is implemented with [React Native Bottom S

```tsx title="packages/app/src/screens/BottomSheetExample.tsx"
import { BottomSheetModal, BottomSheetView } from '@gorhom/bottom-sheet';
import { useBottomSheetDynamicSnapPoints } from '@gorhom/bottom-sheet';
import { useFocusEffect } from '@react-navigation/native';
import * as React from 'react';
import { StyleSheet, Text, View } from 'react-native';
Expand All @@ -24,8 +23,6 @@ import Button from '../components/Button';
import SingleInput from '../components/SingleInput';
import { styles as commonStyles } from '../consts/styles';

const SNAP_POINTS = [ 'CONTENT_HEIGHT' ];

const Backdrop: React.FC = () => <View style={styles.backdrop} />;

export const BottomSheetExample: React.FC = () => {
Expand All @@ -39,13 +36,6 @@ export const BottomSheetExample: React.FC = () => {
bottomSheetModalRef.current?.present();
}

const {
animatedContentHeight,
animatedHandleHeight,
animatedSnapPoints,
handleContentLayout,
} = useBottomSheetDynamicSnapPoints(SNAP_POINTS);

const onFocusEffect = React.useCallback(() => {
AvoidSoftInput.setShouldMimicIOSBehavior(true);
AvoidSoftInput.setEnabled(true);
Expand All @@ -68,14 +58,12 @@ export const BottomSheetExample: React.FC = () => {
<BottomSheetModal
ref={bottomSheetModalRef}
backdropComponent={Backdrop}
contentHeight={animatedContentHeight}
enableDismissOnClose
enableDynamicSizing
enablePanDownToClose
handleHeight={animatedHandleHeight}
index={0}
snapPoints={animatedSnapPoints}
>
<BottomSheetView onLayout={handleContentLayout} style={styles.bottomSheet}>
<BottomSheetView style={styles.bottomSheet}>
<SafeAreaView edges={[ 'bottom', 'left', 'right' ]} style={styles.bottomSheet}>
<Text style={styles.header}>Header</Text>
<SingleInput style={styles.input} />
Expand Down
16 changes: 2 additions & 14 deletions docs/versioned_docs/version-3.0.x/recipes/BOTTOM_SHEET.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ This example assumes the bottom sheet is implemented with [React Native Bottom S

```tsx title="packages/app/src/screens/BottomSheetExample.tsx"
import { BottomSheetModal, BottomSheetView } from '@gorhom/bottom-sheet';
import { useBottomSheetDynamicSnapPoints } from '@gorhom/bottom-sheet';
import { useFocusEffect } from '@react-navigation/native';
import * as React from 'react';
import { StyleSheet, Text, View } from 'react-native';
Expand All @@ -24,8 +23,6 @@ import Button from '../components/Button';
import SingleInput from '../components/SingleInput';
import { styles as commonStyles } from '../consts/styles';

const SNAP_POINTS = [ 'CONTENT_HEIGHT' ];

const Backdrop: React.FC = () => <View style={styles.backdrop} />;

export const BottomSheetExample: React.FC = () => {
Expand All @@ -39,13 +36,6 @@ export const BottomSheetExample: React.FC = () => {
bottomSheetModalRef.current?.present();
}

const {
animatedContentHeight,
animatedHandleHeight,
animatedSnapPoints,
handleContentLayout,
} = useBottomSheetDynamicSnapPoints(SNAP_POINTS);

const onFocusEffect = React.useCallback(() => {
AvoidSoftInput.setShouldMimicIOSBehavior(true);
AvoidSoftInput.setEnabled(true);
Expand All @@ -68,14 +58,12 @@ export const BottomSheetExample: React.FC = () => {
<BottomSheetModal
ref={bottomSheetModalRef}
backdropComponent={Backdrop}
contentHeight={animatedContentHeight}
enableDismissOnClose
enableDynamicSizing
enablePanDownToClose
handleHeight={animatedHandleHeight}
index={0}
snapPoints={animatedSnapPoints}
>
<BottomSheetView onLayout={handleContentLayout} style={styles.bottomSheet}>
<BottomSheetView style={styles.bottomSheet}>
<SafeAreaView edges={[ 'bottom', 'left', 'right' ]} style={styles.bottomSheet}>
<Text style={styles.header}>Header</Text>
<SingleInput style={styles.input} />
Expand Down
16 changes: 2 additions & 14 deletions docs/versioned_docs/version-4.0.x/recipes/BOTTOM_SHEET.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ This example assumes the bottom sheet is implemented with [React Native Bottom S

```tsx title="packages/app/src/screens/BottomSheetExample.tsx"
import { BottomSheetModal, BottomSheetView } from '@gorhom/bottom-sheet';
import { useBottomSheetDynamicSnapPoints } from '@gorhom/bottom-sheet';
import { useFocusEffect } from '@react-navigation/native';
import * as React from 'react';
import { StyleSheet, Text, View } from 'react-native';
Expand All @@ -24,8 +23,6 @@ import Button from '../components/Button';
import SingleInput from '../components/SingleInput';
import { styles as commonStyles } from '../consts/styles';

const SNAP_POINTS = [ 'CONTENT_HEIGHT' ];

const Backdrop: React.FC = () => <View style={styles.backdrop} />;

export const BottomSheetExample: React.FC = () => {
Expand All @@ -39,13 +36,6 @@ export const BottomSheetExample: React.FC = () => {
bottomSheetModalRef.current?.present();
}

const {
animatedContentHeight,
animatedHandleHeight,
animatedSnapPoints,
handleContentLayout,
} = useBottomSheetDynamicSnapPoints(SNAP_POINTS);

const onFocusEffect = React.useCallback(() => {
AvoidSoftInput.setShouldMimicIOSBehavior(true);
AvoidSoftInput.setEnabled(true);
Expand All @@ -68,14 +58,12 @@ export const BottomSheetExample: React.FC = () => {
<BottomSheetModal
ref={bottomSheetModalRef}
backdropComponent={Backdrop}
contentHeight={animatedContentHeight}
enableDismissOnClose
enableDynamicSizing
enablePanDownToClose
handleHeight={animatedHandleHeight}
index={0}
snapPoints={animatedSnapPoints}
>
<BottomSheetView onLayout={handleContentLayout} style={styles.bottomSheet}>
<BottomSheetView style={styles.bottomSheet}>
<SafeAreaView edges={[ 'bottom', 'left', 'right' ]} style={styles.bottomSheet}>
<Text style={styles.header}>Header</Text>
<SingleInput style={styles.input} />
Expand Down
Loading

0 comments on commit 8eb1db7

Please sign in to comment.