question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

FAB not responding if at least once disabled [working with RN 0.59.8 but not with 0.60.4]

See original GitHub issue

If problematically set disabled prop to false then afterwords the FAB never responds with disabled={true}. FAB is greyed out properly according to whether disabled or not but completely freezes if once disabled.

TRIED WITH MULTIPLE PROJECTS USING RN 0.60.4 - GOT SAME RESULTS

Here is my code:-

import React, {Component} from 'react';
import {
    StyleSheet,
    View,
    Text,
    Button,
    Alert
} from 'react-native';

import { FAB } from 'react-native-paper';

export default class FabComponent extends Component {
    state = {
        disableFab: false
    }

    handleFabPress = () => {
        Alert.alert(
            'Alert Title',
            'You pressed the floating button',
            [
              {
                text: 'Cancel',
                onPress: () => console.log('Cancel Pressed'),
                style: 'cancel',
              },
              {text: 'OK', onPress: () => console.log('OK Pressed')},
            ],
            {cancelable: false},
          );
    }

    render() {
        return (
            <View style={styles.container}>
                <View style={{flex: 1, justifyContent: 'center', alignItems: 'center'}}>
                    <Button
                        onPress={() => {
                                this.setState((prevState) => {
                                    return {
                                        disableFab: ! prevState.disableFab
                                    }
                                })
                            }
                        }
                        title={this.state.disableFab? 'Enable FAB' : 'Disable FAB'}
                        color="#488c51"
                    />
                </View>

                <FAB
                    style={styles.fab}
                    small={false}
                    icon="add"
                    disabled={this.state.disableFab}
                    onPress={this.handleFabPress}
                />
            </View>
        )
    }
}

const styles = StyleSheet.create({
    container: {
        flex: 1,
    },
    fab: {
        position: 'absolute',
        margin: 16,
        right: 0,
        bottom: 0,
      },
  });
  

the repo is here - https://github.com/devsrv/rnpaper-fab

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
Trancevercommented, Aug 12, 2019

@devsrv Paper v3 uses react-native-vector-icons/Material-Community-Icons instead of react-native-vector-icons/Material-Icons by default so you need to update name of the icon or use old Icon component via settings prop on PaperProvider. You can see how to do it here

1reaction
pan-pawelcommented, Aug 4, 2019

Hello @devsrv! Can you please try upgrade react-native-paper to 3.0.0-alpha.3? My fix touchable-ripple-toggling-disable-prop was merged there

The problem occurs with RN > 0.60, There were some changes with accessibility 0.59 -> 0.60 and they causing this issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

floating action button on react native - Stack Overflow
I want to use a floating action button in react native android in bottom right corner of the screen. But I am not...
Read more >
Full text of "The U.S. Naval astronomical expedition to the ...
Full text of "The U.S. Naval astronomical expedition to the southern hemisphere, during the years 1849-'50-'51-'52;". See other formats.
Read more >
React Floating Action Button (FAB) component - Material UI
A floating action button appears in front of all screen content, typically as a circular shape with an icon in its center. FABs...
Read more >
Words 219k | PDF - Scribd
25 but 4603799 414960 0.36 659768 598168 590466 729227 35 my 3107804 258460 0.15 457496 367843 871337 297289 45 if 2710989 359865 0.33...
Read more >
Senior Software Engineer, React Native - at hims & hers
A "disabled veteran" is one of the following: a veteran of the U.S. military, ground, naval or air service who is entitled to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found