oblador / react-native-vector-icons

Customizable Icons for React Native with support for image source and full styling.
https://oblador.github.io/react-native-vector-icons/
MIT License
17.31k stars 2.12k forks source link

Why does the name of the Ionicons component in the react-native-vector-icons/Ionicons library not take effect? #1634

Open Qy742698 opened 1 week ago

Qy742698 commented 1 week ago
import React, { useState } from 'react';
import { StyleSheet, View } from 'react-native';
import { Block, Accordion } from 'galio-framework';
import Ionicons from 'react-native-vector-icons/Ionicons'; 
const AccordionDemo = () => {
    const data = [
        { title: "1nd Chapter", content: "Lorem ipsum dolor sit amet" },
        { title: "2nd Chapter", content: "Lorem ipsum dolor sit amet" },
        { title: "3rd Chapter", content: "Lorem ipsum dolor sit amet" }
    ];
    return (
        <View style={styles.container}>
            <Accordion 
            dataArray={data} 
            style={styles.accordion}
            opened={0}
            listStyle={styles.listStyle}
             icon={<Ionicons
                 name="albums"
                 size={20}
                 color="blue"
              >
            </Ionicons>}
            />
        </View>

    )
}

const styles = StyleSheet.create({
    container: {
        flex: 1,
        padding: 20,
        backgroundColor: '#fff',
    },
    accordion: {
        borderWidth: 1,
        borderColor: '#ccc',
        borderRadius: 5,
        overflow: 'hidden',
        // backgroundColor:'red'
    },
    listStyle: {
        borderTopWidth: 10,
        borderTopColor: 'red',
        // backgroundColor:'red'
    },
    headerStyle: {
        backgroundColor: '#5E72E4',
        padding: 10,
    },
    contentStyle: {
        paddingVertical: 10,
        paddingHorizontal: 20,
    },
});
export default AccordionDemo
johnf commented 1 week ago

@Qy742698 What do you mean by "does not take effect"? What happens when you use this code?

Qy742698 commented 1 week ago

@johnf The icon is not displayed. Instead, a question mark (?) is displayed.

1421393078 commented 5 days ago

需要加把这一行 apply from: file("../../node_modules/react-native-vector-icons/fonts.gradle") 加在 android/app/build.gradle。文档里有写的, 我也踩了这个坑

Qy742698 commented 5 days ago

@1421393078 如果是在harmony上面,好像不生效