Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flex item sizing bug on react-native-web #59

Open
yangm97 opened this issue Aug 18, 2021 · 1 comment
Open

Flex item sizing bug on react-native-web #59

yangm97 opened this issue Aug 18, 2021 · 1 comment

Comments

@yangm97
Copy link

yangm97 commented Aug 18, 2021

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch [email protected] for the project I'm working on.

Here is the diff that solved my problem:

diff --git a/node_modules/react-native-draggable-grid/built/src/block.js b/node_modules/react-native-draggable-grid/built/src/block.js
index c107961..8fb7584 100644
--- a/node_modules/react-native-draggable-grid/built/src/block.js
+++ b/node_modules/react-native-draggable-grid/built/src/block.js
@@ -6,11 +6,9 @@ var react_native_1 = require("react-native");
 exports.Block = function (_a) {
     var style = _a.style, dragStartAnimationStyle = _a.dragStartAnimationStyle, onPress = _a.onPress, onLongPress = _a.onLongPress, children = _a.children, panHandlers = _a.panHandlers;
     return (<react_native_1.Animated.View style={[styles.blockContainer, style, dragStartAnimationStyle]} {...panHandlers}>
-      <react_native_1.Animated.View>
         <react_native_1.TouchableWithoutFeedback onPress={onPress} onLongPress={onLongPress}>
           {children}
         </react_native_1.TouchableWithoutFeedback>
-      </react_native_1.Animated.View>
     </react_native_1.Animated.View>);
 };
 var styles = react_native_1.StyleSheet.create({
diff --git a/node_modules/react-native-draggable-grid/src/block.tsx b/node_modules/react-native-draggable-grid/src/block.tsx
index 4caea92..3d8e877 100644
--- a/node_modules/react-native-draggable-grid/src/block.tsx
+++ b/node_modules/react-native-draggable-grid/src/block.tsx
@@ -28,11 +28,9 @@ export const Block: FunctionComponent<BlockProps> = ({
 }) => {
   return (
     <Animated.View style={[styles.blockContainer, style, dragStartAnimationStyle]} {...panHandlers}>
-      <Animated.View>
-        <TouchableWithoutFeedback onPress={onPress} onLongPress={onLongPress}>
-          {children}
-        </TouchableWithoutFeedback>
-      </Animated.View>
+      <TouchableWithoutFeedback onPress={onPress} onLongPress={onLongPress}>
+        {children}
+      </TouchableWithoutFeedback>
     </Animated.View>
   )
 }

This issue body was partially generated by patch-package.

Issue fixed by the above patch: not able to flex-grow an item on web.

Reproduction(ish):

...
  const onRenderItem = (item: any) => (
    <View style={{ flex: 1, flexDirection: 'row' }}>
      {/* your component here */}
    </View>
  )

return (
  <DraggableGrid
        key={numColumns}
        numColumns={numColumns}
        renderItem={onRenderItem}
        style={{ flex: 1 }}
...
@SHISME
Copy link
Owner

SHISME commented Aug 20, 2021

I want know what is problem before you solved it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants