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

Issue in preview of Modal component from React Native #7367

Open
the-mysterious-kid opened this issue May 6, 2023 · 0 comments
Open

Issue in preview of Modal component from React Native #7367

the-mysterious-kid opened this issue May 6, 2023 · 0 comments
Labels

Comments

@the-mysterious-kid
Copy link

I created a Modal component in React Native and exported it to the local host and below shown is how I got the preview.

Screenshot 2023-05-06 at 6 19 27 PM

Steps to Reproduce

  1. Integrate Bit into your project
  2. Create a component that uses Modal or react-native-modal
  3. Add and export that component into the bit local host

Expected Behavior

This is how it should usually show

Screenshot 2023-05-06 at 7 02 19 PM

Code of the Component

import React from 'react';
import {
  StyleSheet,
  Text,
  TouchableOpacity,
  TouchableOpacityProps,
  View,
} from 'react-native';
import Modal from 'react-native-modal';

interface forceupdateProps extends TouchableOpacityProps {
  visible: boolean;
  btnColor?: string;
  onPress: () => void;
}

const forceupdate = ({visible, onPress, btnColor}: forceupdateProps) => {
  return (
    <View style={{flex: 1}}>
      <Modal backdropOpacity={0.3} isVisible={visible}>
        <View style={styles.modalContainer}>
          <View style={styles.container}>
            <Text style={styles.headerText}>Update Available!</Text>
            <Text style={styles.contentText}>
              A new version of the app is available. Please update the app
            </Text>
            <TouchableOpacity
              style={[
                styles.btnContainer,
                btnColor ? {backgroundColor: btnColor} : null,
              ]}
              onPress={onPress}>
              <Text style={styles.btnText}>Update</Text>
            </TouchableOpacity>
          </View>
        </View>
      </Modal>
    </View>
  );
};

export default forceupdate;

const styles = StyleSheet.create({
  modalContainer: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
  },
  container: {
    backgroundColor: '#fff',
    marginHorizontal: 20,
    padding: 10,
    paddingHorizontal: 20,
    borderRadius: 10,
    alignItems: 'center',
  },
  headerText: {
    fontWeight: 'bold',
    fontSize: 22,
    marginBottom: 10,
  },
  contentText: {
    textAlign: 'center',
    fontSize: 14,
    marginBottom: 20,
  },
  btnContainer: {
    backgroundColor: '#555555',
    paddingVertical: 10,
    paddingHorizontal: 30,
    borderRadius: 10,
  },
  btnText: {
    color: '#fff',
    fontWeight: 'bold',
    fontSize: 16,
  },
});

Specifications

  • Bvm version: 0.3.1
  • Bit version: 0.1.27 (stable)
  • Workspace type: harmony
  • React Native: 0.71.7
  • Node: 19.6.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant