Skip to content

Commit

Permalink
Merge pull request #5 from Malaa-tech/1.1.0
Browse files Browse the repository at this point in the history
1.1.0
  • Loading branch information
WadhahEssam authored Aug 24, 2024
2 parents 3c4109e + aaf509a commit 22fb24f
Show file tree
Hide file tree
Showing 13 changed files with 239 additions and 70 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ then do `npx pod-install`
<td><code>cornerSmoothing</code></td>
<td><code>number</code></td>
<td>Controls the amount of smoothing for the radius, <code>0</code> means there is no smoothing (will render like any other <code>View</code>, 100 is maximum amount</td>
<td><code>0</code></td>
<td><code>100</code></td>
</tr>
<tr>
<td><code>preserveSmoothing</code></td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,30 +9,30 @@ class ExpoSquircleViewModule : Module() {
Name("ExpoSquircleView")

View(ExpoSquircleView::class) {
Prop("cornerSmoothing") { view: ExpoSquircleView, prop: Int ->
view.setCornerSmoothing(prop)
}

Prop("borderRadius") { view: ExpoSquircleView, prop: Float ->
view.setBorderRadius(prop)
}

Prop("backgroundColor") { view: ExpoSquircleView, prop: Int? ->
Prop("squircleBackgroundColor") { view: ExpoSquircleView, prop: Int? ->
if (prop != null) {
view.setViewBackgroundColor(prop)
}
}

Prop("borderColor") { view: ExpoSquircleView, prop: Int? ->
Prop("squircleBorderColor") { view: ExpoSquircleView, prop: Int? ->
if (prop != null) {
view.setBorderColor(prop)
}
}

Prop("borderWidth") { view: ExpoSquircleView, prop: Float ->
Prop("squircleBorderWidth") { view: ExpoSquircleView, prop: Float ->
view.setBorderWidth(prop)
}

Prop("borderRadius") { view: ExpoSquircleView, prop: Float ->
view.setBorderRadius(prop)
}

Prop("cornerSmoothing") { view: ExpoSquircleView, prop: Int ->
view.setCornerSmoothing(prop)
}

Prop("preserveSmoothing") { view: ExpoSquircleView, prop: Boolean ->
view.setPreserveSmoothing(prop)
}
Expand Down
61 changes: 56 additions & 5 deletions example/App.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import { SafeAreaView, ScrollView, StyleSheet, Text, View } from "react-native";
import { Button, SafeAreaView, ScrollView, StyleSheet, Text, View } from "react-native";

import { SquircleView } from "expo-squircle-view";
import { Slider } from "@miblanchard/react-native-slider";
import React from "react";
import Animated, { useAnimatedProps, useAnimatedStyle, useSharedValue, withTiming } from "react-native-reanimated";


export default function App() {
const WIDTH = 390;
Expand All @@ -22,6 +24,19 @@ export default function App() {
const [borderWidth, setBorderWidth] = React.useState(BORDER_WIDTH);
const [padding, setPadding] = React.useState(0);


// Reanimated Testing
// const widthSV = useSharedValue(WIDTH);
// const scaleSV = useSharedValue(0.9);
// const animatedStyle = useAnimatedStyle(() => {
// return {
// width: widthSV.value,
// flexDirection: 'row-reverse',
// transform: [{ scale: scaleSV.value }]
// }
// })
// End Reanimated Testing

return (
<SafeAreaView style={{ flex: 1 }}>
<ScrollView contentContainerStyle={styles.container}>
Expand Down Expand Up @@ -121,7 +136,7 @@ export default function App() {
</View>
</View>

<View style={{marginVertical: 20}}>
<View style={{ marginVertical: 20 }}>
<SquircleView
cornerSmoothing={cornerSmoothing}
preserveSmoothing={PRESERVE_SMOOTHING}
Expand All @@ -136,10 +151,12 @@ export default function App() {
borderColor: BORDER_COLOR,
borderRadius: cornerRadius,
borderWidth: borderWidth,
overflow: 'hidden',
}}
>
<Text>Squircle</Text>
<View style={{ backgroundColor: 'yellow', height: 20, width: '100%'}} />
<View style={{ backgroundColor: 'yellow', height: 20, width: '100%' }} />
{/* <View style={{ height: '50%', width: 100, backgroundColor: 'green', position: 'absolute', start: -50, top: 0, opacity: 0.8 }} /> */}
</SquircleView>
</View>

Expand Down Expand Up @@ -180,7 +197,39 @@ export default function App() {
<Text>react-native-figma-squircle</Text>
</SvgSquircleView> */}

<View style={{marginVertical: 20}}>

{/* Reanimated Testing */}
{/* <Button title="change style" onPress={() => {
widthSV.value = withTiming(widthSV.value > 250 ? 200 : 390, { duration: 300 });
scaleSV.value = withTiming(scaleSV.value > 1 ? 0.8 : 1.1, { duration: 300 });
}} />
<Animated.View style={{...animatedStyle }}>
<SquircleView
cornerSmoothing={cornerSmoothing}
preserveSmoothing={PRESERVE_SMOOTHING}
style={{
flex: 1,
height,
padding,
flexDirection: "column",
justifyContent: "center",
alignItems: "center",
backgroundColor: BACKGROUND_COLOR,
borderColor: BORDER_COLOR,
borderRadius: cornerRadius,
borderWidth: borderWidth,
overflow: 'hidden',
}}
>
<Text>Squircle</Text>
<View style={{ backgroundColor: 'yellow', height: 20, width: '100%' }} />
<View style={{ height: '50%', width: 100, backgroundColor: 'green', position: 'absolute', start: -50, top: 0, opacity: 0.8 }} />
</SquircleView>
</Animated.View> */}
{/* End Reanimated Testing */}


<View style={{ marginVertical: 20 }}>
<View
style={{
width,
Expand All @@ -193,10 +242,12 @@ export default function App() {
borderColor: BORDER_COLOR,
borderWidth: borderWidth,
padding,
overflow: 'hidden'
}}
>
<Text>View</Text>
<View style={{ backgroundColor: 'yellow', height: 20, width: '100%'}} />
<View style={{ backgroundColor: 'yellow', height: 20, width: '100%' }} />
{/* <View style={{ height: '50%', width: 100, backgroundColor: 'green', position: 'absolute', start: -50, top: 0, opacity: 0.8 }} /> */}
</View>
</View>
</ScrollView>
Expand Down
2 changes: 2 additions & 0 deletions example/android/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,5 @@ EX_DEV_CLIENT_NETWORK_INSPECTOR=true

# Use legacy packaging to compress native libraries in the resulting APK.
expo.useLegacyPackaging=false

android.extraMavenRepos=[]
15 changes: 14 additions & 1 deletion example/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,19 @@
},
"web": {
"favicon": "./assets/favicon.png"
}
},
"plugins": [
[
"expo-build-properties",
{
"ios": {
"newArchEnabled": false
},
"android": {
"newArchEnabled": false
}
}
]
]
}
}
35 changes: 30 additions & 5 deletions example/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ PODS:
- ReactCommon/turbomodule/bridging
- ReactCommon/turbomodule/core
- Yoga
- ExpoSquircleView (0.5.1):
- ExpoSquircleView (1.0.1):
- ExpoModulesCore
- PocketSVG (~> 2.7.3)
- EXSplashScreen (0.27.5):
Expand Down Expand Up @@ -1437,7 +1437,28 @@ PODS:
- React-logger (= 0.74.2)
- React-perflogger (= 0.74.2)
- React-utils (= 0.74.2)
- RNSVG (15.2.0):
- RNReanimated (3.10.1):
- DoubleConversion
- glog
- hermes-engine
- RCT-Folly (= 2024.01.01.00)
- RCTRequired
- RCTTypeSafety
- React-Codegen
- React-Core
- React-debug
- React-Fabric
- React-featureflags
- React-graphics
- React-ImageManager
- React-NativeModulesApple
- React-RCTFabric
- React-rendererdebug
- React-utils
- ReactCommon/turbomodule/bridging
- ReactCommon/turbomodule/core
- Yoga
- RNSVG (15.6.0):
- React-Core
- SocketRocket (0.7.0)
- Yoga (0.0.0)
Expand Down Expand Up @@ -1514,6 +1535,7 @@ DEPENDENCIES:
- React-runtimescheduler (from `../node_modules/react-native/ReactCommon/react/renderer/runtimescheduler`)
- React-utils (from `../node_modules/react-native/ReactCommon/react/utils`)
- ReactCommon/turbomodule/core (from `../node_modules/react-native/ReactCommon`)
- RNReanimated (from `../node_modules/react-native-reanimated`)
- RNSVG (from `../node_modules/react-native-svg`)
- Yoga (from `../node_modules/react-native/ReactCommon/yoga`)

Expand Down Expand Up @@ -1662,6 +1684,8 @@ EXTERNAL SOURCES:
:path: "../node_modules/react-native/ReactCommon/react/utils"
ReactCommon:
:path: "../node_modules/react-native/ReactCommon"
RNReanimated:
:path: "../node_modules/react-native-reanimated"
RNSVG:
:path: "../node_modules/react-native-svg"
Yoga:
Expand All @@ -1683,7 +1707,7 @@ SPEC CHECKSUMS:
ExpoFont: 43b69559cef3d773db57c7ae7edd3cb0aa0dc610
ExpoKeepAwake: 3b8815d9dd1d419ee474df004021c69fdd316d08
ExpoModulesCore: d7b31b6d68b2ba815c46660d86018c789178fdb9
ExpoSquircleView: 2d77e70f2415a1bc7847703f56d2266602ba0aa6
ExpoSquircleView: 48796bcb38f095ae004cef22a75198f1984b449d
EXSplashScreen: fbf0ec78e9cee911df188bf17b4fe51d15a84b87
EXUpdatesInterface: 996527fd7d1a5d271eb523258d603f8f92038f24
FBLazyVector: 4bc164e5b5e6cfc288d2b5ff28643ea15fa1a589
Expand Down Expand Up @@ -1738,10 +1762,11 @@ SPEC CHECKSUMS:
React-runtimescheduler: 56b642bf605ba5afa500d35790928fc1d51565ad
React-utils: 4476b7fcbbd95cfd002f3e778616155241d86e31
ReactCommon: ecad995f26e0d1e24061f60f4e5d74782f003f12
RNSVG: 43b64ed39c14ce830d840903774154ca0c1f27ec
RNReanimated: 35f9ac9c3ac42d0497ebd1cce5c39d7687a8493e
RNSVG: 5da7a24f31968ec74f0b091e3440080f347e279b
SocketRocket: abac6f5de4d4d62d24e11868d7a2f427e0ef940d
Yoga: ae3c32c514802d30f687a04a6a35b348506d411f

PODFILE CHECKSUM: 9af856da1857856653f759adb9d680e087de8049

COCOAPODS: 1.14.3
COCOAPODS: 1.15.2
6 changes: 5 additions & 1 deletion example/ios/Podfile.properties.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
{
"expo.jsEngine": "hermes",
"EX_DEV_CLIENT_NETWORK_INSPECTOR": "true"
"EX_DEV_CLIENT_NETWORK_INSPECTOR": "true",
"newArchEnabled": "false",
"apple.extraPods": "[]",
"apple.ccacheEnabled": "false",
"apple.privacyManifestAggregationEnabled": "true"
}
Loading

0 comments on commit 22fb24f

Please sign in to comment.