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

SpeedDial cant work in web platform,cuz [...new Array(React.Children.count(children))] will returned [empty × 2] #3879

Open
1 task done
alwaysloseall opened this issue Jan 18, 2024 · 2 comments

Comments

@alwaysloseall
Copy link
Contributor

Is there an existing issue for this?

  • I have searched the existing issues

Explain what you did

 import React, {useState} from 'react';
import {SpeedDial} from '@rneui/themed';

export default function HomeScreen() {
  const [open, setOpen] = useState(false);

  return (
    <SpeedDial
      isOpen={open}
      icon={{name: 'edit', color: '#fff'}}
      openIcon={{name: 'close', color: '#fff'}}
      onOpen={() => setOpen(!open)}
      onClose={() => setOpen(!open)}>
      <SpeedDial.Action
        icon={{name: 'add', color: '#fff'}}
        title="Add"
        onPress={() => console.log('Add Something')}
      />
      <SpeedDial.Action
        icon={{name: 'delete', color: '#fff'}}
        title="Delete"
        onPress={() => console.log('Delete Something')}
      />
    </SpeedDial>
  );
}

Expected behavior

rendering component SpeedDial

Describe the bug

Mask and SpeedDial Always showing,Button can not close Mask
website playground also like this
So I find Code Bug

WX20240118-173518@2x
reactnativeelements_speedDial

Steps To Reproduce

use my code can reproduce

Screenshots

No response

Your Environment

`npx @rneui/envinfo`
  ```
    Output from `npx @rneui/envinfo` goes here.
  ```
@alwaysloseall
Copy link
Contributor Author

alwaysloseall commented Jan 19, 2024

[...new Array(2)will compile to [].concat(new Array(2)) in bundle.js
i use
react-native-web @0.19.10
react-scripts @5.0.1
react-app-rewired @2.2.1

@alwaysloseall
Copy link
Contributor Author

used @babel/preset-env in config-overrides.js and used this config will causing this problem to occur
...addBabelPresets([
'@babel/preset-env',
{
loose: true,
targets: {
browsers: ['> 1%', 'last 2 versions'],
},
modules: 'commonjs',
},
]),

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

No branches or pull requests

1 participant