小编Iba*_*man的帖子

找不到模块:无法解析“swiper/css”

Swiper 7.0.5 swiper/css 给出错误模块未找到:无法解析“swiper/css”

import { Swiper, SwiperSlide } from 'swiper/react';
import 'swiper/css';
function Test() {
 return (
  <Swiper
  spaceBetween={50}
  slidesPerView={3}
  onSlideChange={() => console.log('slide change')}
  onSwiper={(swiper) => console.log(swiper)}
>
  <SwiperSlide>Slide 1</SwiperSlide>
  <SwiperSlide>Slide 2</SwiperSlide>
  <SwiperSlide>Slide 3</SwiperSlide>
  <SwiperSlide>Slide 4</SwiperSlide>
  ...
</Swiper>
);
}

 export default Test;
Run Code Online (Sandbox Code Playgroud)

reactjs swiper.js react-swiper

42
推荐指数
4
解决办法
8万
查看次数

有没有办法直接在本机反应中逐字传输chatgpt api的响应(使用javascript)

我想直接在 React Native (expo) 中使用 Chat GPT Turbo api 与逐字流这里是没有流的工作示例

  fetch(`https://api.openai.com/v1/chat/completions`, {
  body: JSON.stringify({
    model: 'gpt-3.5-turbo',
    messages: [{ role: 'user', content: 'hello' }],
    temperature: 0.3,
    max_tokens: 2000,
  }),
  method: 'POST',
  headers: {
    'content-type': 'application/json',
    Authorization: 'Bearer ' + API_KEY,
  },
}).then((response) => {
  console.log(response); //If you want to check the full response
  if (response.ok) {
    response.json().then((json) => {
      console.log(json); //If you want to check the response as JSON
      console.log(json.choices[0].message.content); //HERE'S THE CHATBOT'S RESPONSE
    });
  }
});
Run Code Online (Sandbox Code Playgroud)

我可以改变什么来逐字流数据

javascript react-native expo openai-api chatgpt-api

8
推荐指数
1
解决办法
2万
查看次数

更新管理视图的属性“lineCap”时出错:expo 中的 AIRMapPolyline

世博版本:sdk42 react-native-maps:0.28和0.27.1都使用react-native-maps-directions这里是代码

   <MapView
    provider={PROVIDER_GOOGLE} // remove if not using Google Maps
    style={styles.map}
    region={getMapRegion()}
  >
    <MapViewDirections
      origin={origin}
      destination={destination}
      apikey={GOOGLE_MAPS_APIKEY}
      strokeWidth={3}
      strokeColor="blue"
    />

    <Marker
      coordinate={getMapRegion()}
      title="Test Title"
      description="This is the test description"
    >
      <Callout tooltip>
        <Text>{text}</Text>
      </Callout>
    </Marker>
  </MapView>
Run Code Online (Sandbox Code Playgroud)

polyline reactjs react-native react-native-maps expo

6
推荐指数
1
解决办法
2964
查看次数

删除 React 导航 v6 中的标题

使用自定义样式删除 React 导航 6 中的标头,这是堆栈导航的代码

 <NavigationContainer>
  <Stack.Navigator
    initialRouteName='OtpScreen'
    // screenOptions={{
    //   headerShown: false,
    // }}
    screenOptions={{ headerMode: 'none' }}
  >
    <Stack.Screen
      options={{ headerShown: false }}
      name='Tabs'
      component={MyTabs}
    />

  </Stack.Navigator>
</NavigationContainer>
Run Code Online (Sandbox Code Playgroud)

标签导航

   <Tab.Navigator
  useHeaderHeight={false}
  screenOptions={
    ({
      headerShown: false,
    },
    ({ route }) => ({
      tabBarIcon: ({ focused, color, size }) => {
        let iconName;

        if (route.name === 'Home') {
          iconName = focused
            ? 'ios-information-circle'
            : 'ios-information-circle-outline';
        } else if (route.name === 'Settings') {
          iconName = focused ? 'ios-list' : 'ios-list';
        } …
Run Code Online (Sandbox Code Playgroud)

react-native react-native-navigation react-navigation

6
推荐指数
1
解决办法
7823
查看次数