我用于@react-native-community/slider我的应用程序,但我面临一个问题,它的高度没有改变,它的宽度在改变,但高度没有改变,有人知道为什么吗?而且我想渲染滑块的值,就像滑块拇指内的蓝色容器一样,有没有办法做到这一点?请帮忙
这是我的滑块代码
<View>
<Text style={[style.fontSize15Med, styles.font15]}>
Number of surveys
</Text>
<View style={styles.daysCont}>
<Text style={[style.fontSize12Med, styles.surveys]}>
{this.state.surveys}
</Text>
</View>
<Slider
style={{width: 320, height: 30, marginLeft: 40}}
minimumValue={0}
maximumValue={10}
step={1}
maximumTrackTintColor={colors.DarkBlue}
minimumTrackTintColor={colors.primary}
thumbTintColor={colors.skyBlue}
value={this.state.surveys}
onValueChange={(val) => this.setState({surveys: val})}
/>
</View>
Run Code Online (Sandbox Code Playgroud)
我正在为我的 django 博客创建类似按钮我导入 api 以使用来自 django rest 框架的 ajex 但我收到错误,因为错误是 get() 得到了一个意外的关键字参数 'pk' django
class PostLikeToggle(RedirectView):
def get_redirect_url(self, *args, **kwargs):
obj = get_object_or_404(Post, pk=kwargs['pk'])
url_ = obj.get_absolute_url()
user = self.request.user
if user.is_authenticated:
if user in obj.likes.all():
obj.likes.remove(user)
else:
obj.likes.add(user)
return url_
from rest_framework.views import APIView
from rest_framework.response import Response
from rest_framework import authentication, permissions
from django.contrib.auth.models import User
class PostLikeApiToggle(APIView):
authentication_classes = [authentication.SessionAuthentication]
permission_classes = [permissions.IsAuthenticated]
def get(self, request, format=None):
usernames = [user.username for user in User.objects.all()]
return Response(usernames) …Run Code Online (Sandbox Code Playgroud) django django-models django-urls django-views django-rest-framework
我正在尝试使用命令在模拟器中运行我的 React Native 应用程序,react-native run-android但它抛出了该错误
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.3/userguide/command_line_interface.html#sec:command_line_warnings
BUILD SUCCESSFUL in 44s
info Connecting to the development server...
warn Failed to connect to development server using "adb reverse": spawnSync /Opt/Android/platform-tools/adb ENOENT
info Starting the app...
The system cannot find the path specified.
error Failed to start the app. Run CLI with --verbose flag for more details. …Run Code Online (Sandbox Code Playgroud) 我正在尝试在物理设备上运行我的应用程序,但出现该错误。我试图用cd android和清理 gradlew ./gradlew clean。我也尝试清理缓存,但它给出了那个错误。我只是安装了反应导航和堆栈导航,然后我收到了那个错误我也尝试重新安装导航包,但仍然遇到同样的错误。有人可以帮我吗?错误和 package.json 在下面
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:mergeDexDebug'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives:
The number of method references in a .dex file cannot exceed 64K.
Learn how to resolve this issue at https://developer.android.com/tools/building/multidex.html
Run Code Online (Sandbox Code Playgroud)
包.json
"dependencies": {
"@react-native-community/google-signin": "^5.0.0",
"@react-native-community/masked-view": "^0.1.10",
"@react-navigation/native": "^5.8.4",
"@react-navigation/stack": "^5.12.1",
"is_js": "^0.9.0",
"react": "16.13.1",
"react-native": "^0.63.1",
"react-native-fbsdk": "^2.0.0",
"react-native-flash-message": "^0.1.16", …Run Code Online (Sandbox Code Playgroud)